示例#1
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.')
示例#2
0
 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.step = step
     self.flow = flow
     self.datastore = datastore
     self.base_attributes = self._get_base_attributes()
示例#3
0
 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')
 def flow_init(self, flow, graph, environment, datastore, logger):
     if environment.TYPE != 'conda':
         raise InvalidEnvironmentException(
             'The *@conda* decorator requires '
             '--environment=conda')