obr.core.queries#
Module Contents#
Classes#
Generic enumeration. |
|
Functions#
|
converts cli input str to a Query object |
|
Convert a json string to list of queries |
|
|
|
convert a list of jobs to a dictionary |
|
Execute queries over a dictionary where the job.id is the key and merged job.docs are the values |
|
Given a list jobs find all jobs for which a query matches |
|
Performs a query and returns a list of records ie for each job the query result |
|
Given a list jobs find all jobs for which a query matches |
|
Given a list jobs find all jobs for which a query matches |
|
This function builds a list of filter queries, where filter queries are queries that request a specific value and has to conform a predicate |
|
This function performs a basic recursive query of the statepoint dictionary |
|
This function performs a basic recursive query of the statepoint dictionary |
|
filter is expected to be a list, string or other iterable of strings in the form of <key><predicate><value> |
Attributes#
- obr.core.queries.logger#
- class obr.core.queries.query_result#
- id: str#
- result: list[dict]#
- sub_keys: list[list[str]]#
- __repr__() str#
Return repr(self).
- class obr.core.queries.Predicates#
Bases:
enum.EnumGeneric enumeration.
Derive from this class to define new enumerations.
- eq = '=='#
- neq = '!='#
- geq = '>='#
- gt = '>'#
- leq = '<='#
- lt = '<'#
- class obr.core.queries.Query#
- key: str#
- value: Any#
- state: dict#
- predicate: str = 'eq'#
- sub_keys: list#
- negate: bool = False#
- execute(key, value)#
- match()#
- __repr__() str#
Return repr(self).
- obr.core.queries.flatten_jobs(jobs: OpenFOAMProject | list[Job]) dict#
convert a list of jobs to a dictionary
- obr.core.queries.query_flat_jobs(jobs: dict[str, dict], queries: list[Query], output, latest_only, strict) list[query_result]#
Execute queries over a dictionary where the job.id is the key and merged job.docs are the values
Parameters: jobs – a job dictionary ordered by job ids queries – list of queries to run output – Whether to print result to screen latest_only – Take only latest value if resulting value is a list strict – needs all queries to be successful to return a result
- obr.core.queries.query_to_dict(jobs: OpenFOAMProject | list[Job], queries: list[Query], output=False, latest_only=True, strict=False) list[query_result]#
Given a list jobs find all jobs for which a query matches
Flattens list of jobs to a dictionary with merged statepoints and job document first
- obr.core.queries.query_impl(jobs: OpenFOAMProject | list[Job], queries: list[Query], output=False, latest_only=True) list[dict]#
Performs a query and returns a list of records ie for each job the query result
- obr.core.queries.query_to_records(jobs: obr.signac_wrapper.operations.OpenFOAMProject, queries: list[Query], latest_only=True, strict=False) list[dict]#
Given a list jobs find all jobs for which a query matches
Flattens list of jobs to a dictionary with merged statepoints and job document first
- obr.core.queries.query_to_dataframe(jobs: obr.signac_wrapper.operations.OpenFOAMProject, queries: list[Query], latest_only=True, strict: bool = False, index: list[str] = [], post_pro: Callable | None = None) pandas.DataFrame#
Given a list jobs find all jobs for which a query matches
Flattens list of jobs to a dictionary with merged statepoints and job document first Args:
index: A list of strings defining which columns should be used as index post_pro: Function to apply to the DataFrame before creating the index
- obr.core.queries.build_filter_query(filters: Iterable[str]) list[Query]#
This function builds a list of filter queries, where filter queries are queries that request a specific value and has to conform a predicate
- obr.core.queries.statepoint_get(statepoint: dict, key: str)#
This function performs a basic recursive query of the statepoint dictionary if the key: value pair is not found in statepoint it recurses into statepoint[“parent”] if present
- obr.core.queries.statepoint_query(statepoint: dict, key: str, value, predicate='==')#
This function performs a basic recursive query of the statepoint dictionary if the key: value pair is not found in statepoint it recurses into statepoint[“parent”] if present
- obr.core.queries.filter_jobs(project, filter: Iterable[str], output: bool = False) list[signac.job.Job]#
filter is expected to be a list, string or other iterable of strings in the form of <key><predicate><value>