Example #1
0
 def __init__(self):
     dependency_solver = CONDA_DEPENDENCY_RESOLVER.lower()
     self._bin = which(dependency_solver)
     # Check if the dependency solver exists.
     if self._bin is None:
         raise InvalidEnvironmentException(
             "No %s installation found. Install %s first." %
             (dependency_solver, dependency_solver))
     # Check for a minimum version for conda when conda or mamba is used
     # for dependency resolution.
     if dependency_solver == "conda" or dependency_solver == "mamba":
         if LooseVersion(
                 self._info()["conda_version"]) < LooseVersion("4.6.0"):
             msg = "Conda version 4.6.0 or newer is required."
             if dependency_solver == "mamba":
                 msg += " Visit https://mamba.readthedocs.io/en/latest/installation.html for installation instructions."
             else:
                 msg += " Visit https://docs.conda.io/en/latest/miniconda.html for installation instructions."
             raise InvalidEnvironmentException(msg)
     # Check if conda-forge is available as a channel to pick up Metaflow's
     # dependencies. This check will go away once all of Metaflow's
     # dependencies are vendored in.
     if "conda-forge" not in "\t".join(self._info()["channels"]):
         raise InvalidEnvironmentException(
             "Conda channel 'conda-forge' is required. Specify it with CONDA_CHANNELS environment variable."
         )
Example #2
0
 def __init__(self):
     self._bin = which('conda')
     if self._bin is None:
         raise InvalidEnvironmentException('No conda installation found. '
                                           'Install conda first.')
     if LooseVersion(self._info()['conda_version']) < LooseVersion('4.6.0'):
         raise InvalidEnvironmentException(
             'Conda version 4.6.0 or newer '
             'is required. Visit '
             'https://docs.conda.io/en/latest/miniconda.html '
             'for installation instructions.')
     if 'conda-forge' not in self.config()['channels']:
         raise InvalidEnvironmentException(
             'Conda channel \'conda-forge\' '
             'is required. Specify it with CONDA_CHANNELS '
             'environment variable.')
Example #3
0
 def __init__(self):
     self._bin = which("conda")
     if self._bin is None:
         raise InvalidEnvironmentException("No conda installation found. "
                                           "Install conda first.")
     if LooseVersion(self._info()["conda_version"]) < LooseVersion("4.6.0"):
         raise InvalidEnvironmentException(
             "Conda version 4.6.0 or newer "
             "is required. Visit "
             "https://docs.conda.io/en/latest/miniconda.html "
             "for installation instructions.")
     if "conda-forge" not in self.config()["channels"]:
         raise InvalidEnvironmentException(
             "Conda channel 'conda-forge' "
             "is required. Specify it with CONDA_CHANNELS "
             "environment variable.")
Example #4
0
 def flow_init(self,
               flow,
               graph,
               environment,
               datastore,
               metadata,
               logger,
               echo,
               options):
     if environment.TYPE != 'conda':
         raise InvalidEnvironmentException('The *@conda* decorator requires '
                                           '--environment=conda')
 def step_init(self, flow, graph, step, decos, environment, datastore, logger):
     if environment.TYPE != 'conda':
         raise InvalidEnvironmentException('The *@conda* decorator requires '
                                           '--environment=conda')
     def _logger(line, **kwargs):
         logger(line)
     self.local_root = LocalDataStore.get_datastore_root_from_config(_logger)
     environment.set_local_root(self.local_root)
     self.architecture = self._architecture(decos)
     self.disable_safety_checks = self._disable_safety_checks(decos)
     self.step = step
     self.flow = flow
     self.datastore = datastore
     self.base_attributes = self._get_base_attributes()
     os.environ['PYTHONNOUSERSITE'] = '1'
 def _architecture(self, decos):
     for deco in decos:
         if deco.name == 'batch':
             # force conda resolution for linux-64 architectures
             return 'linux-64'
     bit = '32'
     if platform.machine().endswith('64'):
         bit = '64'
     if platform.system() == 'Linux':
         return 'linux-%s' % bit
     elif platform.system() == 'Darwin':
         return 'osx-%s' % bit
     else:
         raise InvalidEnvironmentException('The *@conda* decorator is not supported '
                                           'outside of Linux and Darwin platforms')
Example #7
0
 def _architecture(self, decos):
     for deco in decos:
         if deco.name in ("batch", "kubernetes"):
             # force conda resolution for linux-64 architectures
             return "linux-64"
     bit = "32"
     if platform.machine().endswith("64"):
         bit = "64"
     if platform.system() == "Linux":
         return "linux-%s" % bit
     elif platform.system() == "Darwin":
         return "osx-%s" % bit
     else:
         raise InvalidEnvironmentException(
             "The *@conda* decorator is not supported "
             "outside of Linux and Darwin platforms")