Пример #1
0
def create_system_storage_data(context_creation_data, system_storage_data,
                               scoped_resources_builder):
    check.inst_param(context_creation_data, "context_creation_data",
                     ContextCreationData)

    environment_config, pipeline_def, system_storage_def, pipeline_run = (
        context_creation_data.environment_config,
        context_creation_data.pipeline_def,
        context_creation_data.system_storage_def,
        context_creation_data.pipeline_run,
    )

    system_storage_data = (system_storage_data if system_storage_data else
                           construct_system_storage_data(
                               InitSystemStorageContext(
                                   pipeline_def=pipeline_def,
                                   mode_def=context_creation_data.mode_def,
                                   system_storage_def=system_storage_def,
                                   system_storage_config=environment_config.
                                   storage.system_storage_config,
                                   pipeline_run=pipeline_run,
                                   instance=context_creation_data.instance,
                                   environment_config=environment_config,
                                   type_storage_plugin_registry=
                                   construct_type_storage_plugin_registry(
                                       pipeline_def, system_storage_def),
                                   resources=scoped_resources_builder.build(
                                       context_creation_data.system_storage_def
                                       .required_resource_keys, ),
                               )))

    return system_storage_data
Пример #2
0
def create_system_storage_data(context_creation_data, system_storage_data,
                               scoped_resources_builder):
    check.inst_param(context_creation_data, 'context_creation_data',
                     ContextCreationData)

    environment_config, pipeline_def, system_storage_def, run_config = (
        context_creation_data.environment_config,
        context_creation_data.pipeline_def,
        context_creation_data.system_storage_def,
        context_creation_data.run_config,
    )

    system_storage_data = (
        system_storage_data
        if system_storage_data else construct_system_storage_data(
            InitSystemStorageContext(
                pipeline_def=pipeline_def,
                mode_def=context_creation_data.mode_def,
                system_storage_def=system_storage_def,
                system_storage_config=environment_config.storage.
                system_storage_config,
                run_config=run_config,
                environment_config=environment_config,
                type_storage_plugin_registry
                =construct_type_storage_plugin_registry(
                    pipeline_def, system_storage_def),
                resources=scoped_resources_builder.build(
                    # currently provide default for resource mapping
                    lambda resources, resources_deps:
                    {r: resources.get(r)
                     for r in resources_deps},
                    context_creation_data.system_storage_def.
                    required_resource_keys,
                ),
            )))

    system_storage_data.run_storage.create_run(
        pipeline_name=pipeline_def.name,
        run_id=run_config.run_id,
        env_config=environment_config.original_config_dict,
        mode=context_creation_data.mode_def.name,
    )

    return system_storage_data