hpcflow.sdk.app.App#

class hpcflow.sdk.app.App(*args, **kwargs)#

Bases: BaseApp

Class from which to instantiate downstream app objects (e.g. MatFlow).

Methods

clear_known_submissions_file

Clear the known-submissions file of all submissions.

clear_user_runtime_dir

Delete the contents of the user runtime directory.

copy_demo_workflow

Copy a builtin demo workflow to the specified location.

get_OS_supported_schedulers

Retrieve a list of schedulers that are supported in principle by this operating system.

get_config_path

Return the full path to the config file, without loading the config.

get_demo_workflow_template_file

Context manager to get a (temporary) file path to an included demo workflow template.

get_info

get_parameter_task_schema_map

Get a dict mapping parameter types to task schemas that input/output each parameter.

get_scheduler

Get an arbitrary scheduler object.

list_demo_workflows

Return a list of demo workflow templates included in the app.

load_builtin_template_component_data

load_config

load_demo_workflow

Load a WorkflowTemplate object from a builtin demo template file.

load_template_components

perm_error_retry

Return a decorator for retrying functions on permission and OS errors that might be associated with cloud-storage desktop sync.

read_known_submissions_file

Retrieve existing workflows that might be running.

reload_config

reload_template_components

reset_config

Reset the config file to defaults, and reload the config.

set_inactive_in_known_subs_file

Set workflows in the known-submissions file to the non-running state.

show_demo_workflow

Print the contents of a builtin demo workflow template file.

template_components_from_json_like

unload_config

Attributes

API_logger

CLI_logger

command_files

config

config_logger

envs

is_config_loaded

is_template_components_loaded

known_subs_file_name

known_subs_file_path

log

logger

parameters

persistence_logger

run_time_info

runtime_info_logger

scheduler_lookup

scripts

submission_logger

task_schemas

template_components

user_data_dir

user_data_hostname_dir

We segregate by hostname to account for the case where multiple machines might use the same shared file system

user_runtime_dir

Retrieve a temporary directory.

property API_logger: Logger#
property CLI_logger: Logger#
clear_known_submissions_file()#

Clear the known-submissions file of all submissions. This shouldn’t be needed normally.

clear_user_runtime_dir()#

Delete the contents of the user runtime directory.

property command_files: CommandFilesList#
property config: Config#
property config_logger: Logger#
copy_demo_workflow(name, dst=None, doc=True)#

Copy a builtin demo workflow to the specified location.

Parameters:
  • name (str) – The name of the demo workflow to copy

  • dst (PathLike | None) – Directory or full file path to copy the demo workflow to. If not specified, the current working directory will be used.

  • doc (bool) – If False, the copied workflow template file will not include the doc attribute (if originally present).

Return type:

None

property envs: EnvironmentsList#
get_OS_supported_schedulers()#

Retrieve a list of schedulers that are supported in principle by this operating system.

This does not necessarily mean all the returned schedulers are available on this system.

get_config_path(config_dir=None)#

Return the full path to the config file, without loading the config.

get_demo_workflow_template_file(name, doc=True, delete=True)#

Context manager to get a (temporary) file path to an included demo workflow template.

Parameters:
  • name (str) – Name of the builtin demo workflow template whose file path is to be retrieved.

  • doc (bool) – If False, the yielded path will be to a file without the doc attribute (if originally present).

  • delete (bool) – If True, remove the temporary file on exit.

Return type:

Path

get_info()#
Return type:

Dict[str, Any]

get_parameter_task_schema_map()#

Get a dict mapping parameter types to task schemas that input/output each parameter.

Return type:

Dict[str, List[List]]

get_scheduler(scheduler_name, os_name, scheduler_args=None)#

Get an arbitrary scheduler object.

property is_config_loaded: bool#
property is_template_components_loaded: bool#
property known_subs_file_name#
property known_subs_file_path#
list_demo_workflows()#

Return a list of demo workflow templates included in the app.

Return type:

Tuple[str]

classmethod load_builtin_template_component_data(package)#
Return type:

Dict[str, List | Dict]

load_config(config_dir=None, config_key=None, **overrides)#
Return type:

None

load_demo_workflow(name)#

Load a WorkflowTemplate object from a builtin demo template file.

Parameters:

name (str) –

Return type:

WorkflowTemplate

load_template_components(warn=True)#
Return type:

None

property log: AppLog#
property logger: Logger#
property parameters: ParametersList#
perm_error_retry()#

Return a decorator for retrying functions on permission and OS errors that might be associated with cloud-storage desktop sync. engine operations.

property persistence_logger: Logger#
read_known_submissions_file()#

Retrieve existing workflows that might be running.

Return type:

List[Dict]

reload_config(config_dir=None, config_key=None, **overrides)#
Return type:

None

reload_template_components(warn=True)#
Return type:

None

reset_config(config_dir=None, config_key=None, **overrides)#

Reset the config file to defaults, and reload the config.

Return type:

None

property run_time_info: RunTimeInfo#
property runtime_info_logger: Logger#
property scheduler_lookup#
property scripts#
set_inactive_in_known_subs_file(inactive_IDs)#

Set workflows in the known-submissions file to the non-running state.

Note we aim for atomicity to help with the scenario where a new workflow submission is adding itself to the file at the same time as we have decided an existing workflow should no longer be part of this file. Ideally, such a scenario should not arise because both operations should only ever be interactively initiated by the single user (Workflow.submit and App.get_known_submissions). If this operation is atomic, then at least the known-submissions file should be left in a usable (but inaccurate) state.

Returns:

List of local IDs removed from the known-submissions file due to the maximum number of recent workflows to store being exceeded.

Return type:

removed_IDs

Parameters:

inactive_IDs (List[int]) –

show_demo_workflow(name, syntax=True, doc=False)#

Print the contents of a builtin demo workflow template file.

Parameters:
  • name (str) – The name of the demo workflow file to print.

  • syntax (bool) – If True, use rich to syntax-highlight the output.

  • doc (bool) – If False, the printed workflow template file contents will not include the doc attribute (if originally present).

property submission_logger: Logger#
property task_schemas: TaskSchemasList#
property template_components: Dict[str, ObjectList]#
template_components_from_json_like(json_like)#
Return type:

None

unload_config()#
property user_data_dir: Path#
property user_data_hostname_dir: Path#

We segregate by hostname to account for the case where multiple machines might use the same shared file system

property user_runtime_dir: Path#

Retrieve a temporary directory.