StudiesSetup#
Qualified name: api.simulation.studies.studies\_setup.StudiesSetup
- class api.simulation.studies.studies_setup.StudiesSetup[source]#
Bases:
object
Entry point for the studies API
You should create this object using the
SimulationSetup
object.Methods
Adds a job from a parameters dict
Adds tags to the available tags
Creates a
JobCreationContext
object for handling job creation for this studyGet the available job type names
Removes a job from the study
Remove tags from the available tags
Changes the name of the study
Sets the study being edited in this setup object.
Changes the name of the study
- add_job(parameters_dict: dict) StudiesSetup [source]#
Adds a job from a parameters dict
Deprecated
add_job will be removed in a future MORe release, it is replaced by
create_job_setup()
which streamlines the job creation process- Parameters:
parameters_dict (dict) – The parameters dict consisting of parameter uuid’s and parameters to add as a new job to the study
- Returns:
self
- Return type:
- add_tags(tags: List[str]) StudiesSetup [source]#
Adds tags to the available tags
Example
To add tags to the list available in the program:
>>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> simulation_setup = api.create_simulation_setup() >>> study_setup = simulation_setup.create_study_setup().set_name(name='study_name') >>> study_setup.add_tags(['first_tag', 'second_tag']) <more.api.simulation.studies.studies_setup.StudiesSetup object at 0x...>
- Parameters:
tags (list of strings) – A list of tag names to add to the available tags
- Returns:
self
- Return type:
- Raises:
TypeError – Raised if a non-string value is given as one of the tags
- create_job_setup(job_name: str) JobCreationContext [source]#
Creates a
JobCreationContext
object for handling job creation for this studyExample
>>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> simulation_setup = api.create_simulation_setup() >>> study_setup = simulation_setup.create_study_setup() >>> print(study_setup.get_available_job_type_names()) # Check which job type names are available [...] >>> study_setup.create_job_setup(job_name='Static Job') # Adds a static job and returns a job creation pipeline object <more.api.simulation.studies.job_setup.JobCreationContext object at 0x...>
- Parameters:
job_name (str) – The name of the job type to add
- Returns:
An object for setting up the job
- Return type:
- Raises:
KeyError – Raised if no job type with the given name exists
- get_available_job_type_names() List[str] [source]#
Get the available job type names
Example
>>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> simulation_setup = api.create_simulation_setup() >>> study_setup = simulation_setup.create_study_setup() >>> study_setup.get_available_job_type_names() [...]
- Returns:
The list of available job type names to use with the create_job_setup method
- Return type:
list of strings
- remove_job(job_label: str | None = None) StudiesSetup [source]#
Removes a job from the study
Example
To remove a job by label:
>>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> simulation_setup = api.create_simulation_setup() >>> study_setup = simulation_setup.create_study_setup() >>> job_setup = study_setup.create_job_setup(job_name='Static Job') >>> job_setup.set_general_job_settings_parameter(parameter_name='label', value='first_job') \ ... .create() \ ... .set_general_job_settings_parameter(parameter_name='label', value='second_job') \ ... .create() \ ... .set_general_job_settings_parameter(parameter_name='label', value='third_job') \ ... .create() <more.api.simulation.studies.job_setup.JobCreationContext object at 0x...> >>> study_setup.remove_job(job_label='second_job') # Remove the second job <more.api.simulation.studies.studies_setup.StudiesSetup object at 0x...>
- Parameters:
job_label (str, optional) – The label of the job to remove, if none is specified then the last job will be removed
- Returns:
self
- Return type:
- Raises:
KeyError – Raised if no job with the given label exists
- remove_tags(tags: list) StudiesSetup [source]#
Remove tags from the available tags
Example
To remove tags to the list available in the program (first tags are added):
>>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> simulation_setup = api.create_simulation_setup() >>> study_setup = simulation_setup.create_study_setup().set_name(name='study_name') >>> study_setup.add_tags(['first_tag', 'second_tag', 'third_tag']) <more.api.simulation.studies.studies_setup.StudiesSetup object at 0x...> >>> study_setup.remove_tags(tags=['first_tag', 'third_tag']) <more.api.simulation.studies.studies_setup.StudiesSetup object at 0x...>
- Parameters:
tags (list of strings) – A list of tag names to remove from the available tags
- Returns:
self
- Return type:
- Raises:
KeyError – Raised if a tag with the given name does not exist
- set_name(name: str) StudiesSetup [source]#
Changes the name of the study
Example
>>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> simulation_setup = api.create_simulation_setup() >>> study_setup = simulation_setup.create_study_setup().set_name(name='study_name') >>> study_setup.set_name(name='new_name') <more.api.simulation.studies.studies_setup.StudiesSetup object at 0x...>
- Parameters:
name (str) – The new name of the study
- Returns:
self
- Return type:
- Raises:
TypeError – Raised if the given name is not a string
- set_study(study: StudyInterface) StudiesSetup [source]#
Sets the study being edited in this setup object.
Deprecated
set_study will be removed in a future MORe release, it is replaced by the
SimulationSetup
Example
This method is invoked internally when using the
SimulationSetup
>>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> simulation_setup = api.create_simulation_setup()
>>> study_setup = simulation_setup.get_study_setup(name='study_name') # invoked internally here, the study must already exist
- Parameters:
study (StudyTable) – A study instance
- Returns:
self
- Return type:
- Raises:
ValueError – Raised if the given study is not an instance of a study
- set_study_name(name: str) StudiesSetup [source]#
Changes the name of the study
- Parameters:
name (str) – The new name of the study
- Returns:
self
- Return type: