obr.create_tree

Module Contents

Functions

flatten(d[, parent_key, sep])

get_path_from(→ str)

Derive a view path from schema and the value dict

extract_from_operation(→ dict)

takes an operation dictionary and do some processing

generate_view(project, workspace, view_path, ...)

Parameters:

is_on_requested_parent(→ bool)

Check if operation requests to be on specific parent

clean_path(→ str)

Clean path name

to_dict(→ dict)

expand_generator_block(operation[, base_dict])

given an operation this function

add_variations(→ list[str])

Recursively adds variations to the project and initialises the jobs. This

setup_job_doc(→ None)

Sets basic information in the job document

create_tree(project, config, arguments[, ...])

obr.create_tree.flatten(d, parent_key='', sep='/')
obr.create_tree.get_path_from(operation: dict, value: dict) str

Derive a view path from schema and the value dict

Returns: a view path as string

obr.create_tree.extract_from_operation(operation: dict, value) dict

takes an operation dictionary and do some processing It extracts keys path and args from the operation dictionary based on given value. The passed value is used as a selector to create keys path and args.

  • args are later used to pass it to the selected operation,

either the operation contains: 1. {key: key, values: [v1, v2, …]} or 2. {values: [{k:v1},{k:v2}] } 2. {common: {c1:v1, c2:v2}, values: [{k:v1},{k:v2}] }

  • the path is derived from the schema key value pair

a entry {schema: path/{foo}, values: [{foo: 1}]} will be formatted to path/1

Returns: a dictionary with keys, path and args

obr.create_tree.generate_view(project: obr.signac_wrapper.operations.OpenFOAMProject, workspace: pathlib.Path, view_path: pathlib.Path, id_path_mapping: dict)
Parameters:
  • workspace: folder that contains the workspace folder

  • view_path: path where the view should be created

  • id_path_mapping: dictionary from job.id to relative path name

obr.create_tree.is_on_requested_parent(operation, parent_job) bool

Check if operation requests to be on specific parent

Returns true if either on correct parent job or no parent was requested

obr.create_tree.clean_path(path_name: str) str

Clean path name

obr.create_tree.to_dict(synced_dict) dict
obr.create_tree.expand_generator_block(operation, base_dict={})

given an operation this function

obr.create_tree.add_variations(operations: list, project: obr.signac_wrapper.operations.OpenFOAMProject, variation: list, parent_job: signac.job.Job, id_path_mapping: dict) list[str]

Recursively adds variations to the project and initialises the jobs. This creates the workspace/uid folder and signac files as sideeffect.

Returns: A list of all operation names

obr.create_tree.setup_job_doc(job: signac.job.Job, reset: bool = False) None

Sets basic information in the job document

obr.create_tree.create_tree(project: obr.signac_wrapper.operations.OpenFOAMProject, config: dict, arguments: dict, skip_foam_src_check: bool = False)