Repository: DataBiosphere/toil

Issue:
Provisioner should refuse to try to start ARM Mesos clusters
We know that ARM Mesos clusters don't work, but since Mesos is still the default cluster type, it's easy to try to start one on accident. You end up getting midway through starting the leader, and timing out because the leader appliance won't start.

We should diagnose this problem when `toil launch-cluster` is starting, and complain then, before we make any resources.

┆Issue is synchronized with this [Jira Story](https://ucsc-cgl.atlassian.net/browse/TOIL-1151)
┆friendlyId: TOIL-1151



Discussion:

Resolving patch:
diff --git a/src/toil/provisioners/__init__.py b/src/toil/provisioners/__init__.py
--- a/src/toil/provisioners/__init__.py
+++ b/src/toil/provisioners/__init__.py
@@ -14,7 +14,7 @@
 import argparse
 import logging
 from difflib import get_close_matches
-from typing import TYPE_CHECKING, List, Optional, Set, Tuple, Union
+from typing import TYPE_CHECKING, List, Optional, Set, Type, Tuple, Union
 
 if TYPE_CHECKING:
     from toil.provisioners.aws.awsProvisioner import AWSProvisioner
@@ -182,3 +182,12 @@ class ClusterTypeNotSupportedException(Exception):
     """Indicates that a provisioner does not support a given cluster type."""
     def __init__(self, provisioner_class, cluster_type):
         super().__init__(f"The {provisioner_class} provisioner does not support making {cluster_type} clusters")
+
+class ClusterCombinationNotSupportedException(Exception):
+    """Indicates that a provisioner does not support making a given type of cluster with a given architecture."""
+    def __init__(self, provisioner_class: Type, cluster_type: str, architecture: str, reason: Optional[str] = None):
+        message = (f"The {provisioner_class} provisioner does not support making {cluster_type} clusters "
+                   f"using nodes with the {architecture} architecture.")
+        if reason is not None:
+            message += f" This is because: {reason}"
+        super().__init__(message)
diff --git a/src/toil/provisioners/aws/awsProvisioner.py b/src/toil/provisioners/aws/awsProvisioner.py
--- a/src/toil/provisioners/aws/awsProvisioner.py
+++ b/src/toil/provisioners/aws/awsProvisioner.py
@@ -61,7 +61,7 @@
     old_retry,
     retry,
 )
-from toil.provisioners import NoSuchClusterException
+from toil.provisioners import NoSuchClusterException, ClusterCombinationNotSupportedException
 from toil.provisioners.abstractProvisioner import (
     AbstractProvisioner,
     ManagedNodesNotSupportedException,
@@ -310,6 +310,12 @@ def launchCluster(self,
         self._keyName = keyName
         self._architecture = leader_type.architecture
 
+        if self.clusterType == 'mesos' and self._architecture != 'amd64':
+            # Mesos images aren't currently available for this architecture, so we can't start a Mesos cluster.
+            # Complain about this before we create anything.
+            raise ClusterCombinationNotSupportedException(type(self), self.clusterType, self._architecture,
+                                                          reason="Mesos is only available for amd64.")
+
         if vpcSubnet:
             # This is where we put the leader
             self._leader_subnet = vpcSubnet


Test patch: