def __init__(self, attributes=None, statically_defined=False): super(BatchDecorator, self).__init__(attributes, statically_defined) # If no docker image is explicitly specified, impute a default image. if not self.attributes["image"]: # If metaflow-config specifies a docker image, just use that. if BATCH_CONTAINER_IMAGE: self.attributes["image"] = BATCH_CONTAINER_IMAGE # If metaflow-config doesn't specify a docker image, assign a # default docker image. else: # Metaflow-R has it's own default docker image (rocker family) if R.use_r(): self.attributes["image"] = R.container_image() # Default to vanilla Python image corresponding to major.minor # version of the Python interpreter launching the flow. else: self.attributes["image"] = "python:%s.%s" % ( platform.python_version_tuple()[0], platform.python_version_tuple()[1], ) # Assign docker registry URL for the image. if not get_docker_registry(self.attributes["image"]): if BATCH_CONTAINER_REGISTRY: self.attributes["image"] = "%s/%s" % ( BATCH_CONTAINER_REGISTRY.rstrip("/"), self.attributes["image"], )
def __init__(self, attributes=None, statically_defined=False): super(BatchDecorator, self).__init__(attributes, statically_defined) if not self.attributes['image']: if BATCH_CONTAINER_IMAGE: self.attributes['image'] = BATCH_CONTAINER_IMAGE else: if R.use_r(): self.attributes['image'] = R.container_image() else: self.attributes['image'] = 'python:%s.%s' % (platform.python_version_tuple()[0], platform.python_version_tuple()[1]) if not BatchDecorator._get_registry(self.attributes['image']): if BATCH_CONTAINER_REGISTRY: self.attributes['image'] = '%s/%s' % (BATCH_CONTAINER_REGISTRY.rstrip('/'), self.attributes['image'])