StudiesSetup¶
Qualified name: api.simulation.studies.studies_setup.StudiesSetup
- class api.simulation.studies.studies_setup.StudiesSetup(item)[source]¶
- Bases: - ABC- Entry point for the studies API - You should create this object using the - SimulationSetupobject.- Methods - Adds a job from a parameters dict - Adds tags to the available tags - Creates a - JobCreationContextobject for handling job creation for this study- Runs the study - Get the available job type names - Returns the name of the object - 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 - abstractmethod 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:
 
 - abstractmethod 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...> - 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 
 
 - abstractmethod create_job_setup(job_name: str) JobCreationContext[source]¶
- Creates a - JobCreationContextobject for handling job creation for this study- Example - >>> 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 [...] >>> job_setup = study_setup.create_job_setup(job_name='Static Job') # Adds a static job and returns a job creation pipeline object - Parameters:
- job_name (str) – The name of the job type to add 
- Returns:
- An object for setting up the job 
- Return type:
- Raises:
- NameNotFoundError – Raised if no job type with the given name exists 
 
 - abstractmethod execute_study(create_simresult_object: bool)[source]¶
- Runs the study - Experimental - ‘execute_study’ returns internal MORe objects that are subject to change, do not use this method in stable code 
 - abstractmethod 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 
 
 - abstractmethod get_name() str[source]¶
- Returns the name of the object - 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...> >>> study_setup.get_name() 'new_name' - Returns:
- name – The name of the object 
- Return type:
- str 
 
 - abstractmethod 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 = 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() - >>> study_setup.remove_job(job_label='second_job') # Remove the second job <more...> - 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:
- NameNotFoundError – Raised if no job with the given label exists 
 
 - abstractmethod 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...> >>> study_setup.remove_tags(tags=['first_tag', 'third_tag']) <more...> - Parameters:
- tags (list of strings) – A list of tag names to remove from the available tags 
- Returns:
- self 
- Return type:
- Raises:
- NameNotFoundError – Raised if a tag with the given name does not exist 
 
 - abstractmethod set_name(name: str, resolve_duplicate_name: bool = False) 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...> >>> second_study_setup = simulation_setup.create_study_setup() \ ... .set_name(name='new_name', resolve_duplicate_name=True) >>> second_study_setup.get_name() 'new_name 1' - Parameters:
- resolve_duplicate_name (bool) – Whether to automatically assign a new name when the chosen one is already taken 
- name (str) – The new name of the study 
 
- Returns:
- self 
- Return type:
- Raises:
- TypeError – Raised if the given name is not a string 
- NameNotUniqueError – Raised if the given name is not unique 
 
 
 - abstractmethod set_study(study) 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 
 
 - abstractmethod 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: