def submit_lightflow_job(request): ''' Submit an interpolation job to lightflow uid : the uid of the data set ''' config = Config() config.load_from_file(lightflow_config_file) store_args = dict() store_args['request'] = request job_id = start_workflow(name='interpolation', config=config, store_args=store_args, queue='iss-workflow') print('Started workflow with ID', job_id)
def ingest_config_obj(ctx, *, silent=True): """ Ingest the configuration object into the click context. """ try: ctx.obj['config'] = Config.from_file(ctx.obj['config_path']) except ConfigLoadError as err: click.echo(_style(ctx.obj['show_color'], str(err), fg='red', bold=True)) if not silent: raise click.Abort()
def config_default(dest): """ Create a default configuration file. \b DEST: Path or file name for the configuration file. """ conf_path = Path(dest).resolve() if conf_path.is_dir(): conf_path = conf_path / LIGHTFLOW_CONFIG_NAME conf_path.write_text(Config.default()) click.echo('Configuration written to {}'.format(conf_path))
def default_config(): """ Endpoint for listing the default configuration of lightflow. The result is a dictionary of the default lightflow configuration. """ return ApiResponse({'config': yaml.safe_load(Config.default())})
def test_list_workflows_when_no_workflow_dirs_in_config(): config = Config() config.load_from_dict({'workflows': []}) assert list_workflows(config) == []
def test_list_workflows_handles_missing_parameters(): config = Config() workflows_path = str(Path(__file__).parent / 'fixtures/workflows') config.load_from_dict({'workflows': [workflows_path]}) assert 'parameters_workflow' in {wf.name for wf in list_workflows(config)}
from lightflow.config import Config from lightflow_rest.core.app import create_app config = Config() config.load_from_file() app = create_app(config)