def setup(self, mongo_url=None, bucket=None, celeryconf=None): from omegaml.client.cloud import setup_from_config try: omega = setup_from_config() except SystemError: omega = Omega(mongo_url=None, bucket=bucket, celeryconf=None) if not self.initialized: self.initialized = True self.omega = omega return omega
def get_omega(args): from omegaml import setup, _base_config from omegaml.client.cloud import setup_from_config config_file = args.get('--config') local_runtime = args.get('--local-runtime') if local_runtime: _base_config.OMEGA_LOCAL_RUNTIME = True bucket = args.get('--bucket') if config_file: om = setup_from_config(config_file) else: om = setup() return om[bucket]
def get_omega(args, require_config=False): from omegaml import setup, _base_config from omegaml.client.cloud import setup_from_config config_file = args.get('--config') # deprecated, use --local local_runtime = args.get('--local-runtime') local = args.get('--local') if local or local_runtime: _base_config.OMEGA_LOCAL_RUNTIME = True bucket = args.get('--bucket') if config_file or require_config: try: om = setup_from_config(config_file) except Exception as e: msg = (f'Config file could not be found due to {e}. Specify as --config or set ' 'OMEGA_CONFIG_FILE env variable') raise ValueError(msg) else: om = setup() if local: om.runtime.mode(local=True) return om[bucket] if bucket else om # for speed
def setup_cloud_config(): from omegaml.client.cloud import setup_from_config return setup_from_config(fallback=setup_base)