Run
add_list_to_str(var_str, var_list)
Adds all entries in var_list
to end of var_str
.
If var_str = 'hello'
and var_list = ['Bob', 'Alice']
then will return 'hello Bob Alice'
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
var_str
|
str
|
Starting string, to which |
required |
var_list
|
Optional[Union[List, float, int, str]]
|
List of entries to add to |
required |
Returns:
Name | Type | Description |
---|---|---|
var_str |
str
|
Initial |
Source code in isca_tools/jasmin/run/base.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
get_slurm_info_from_file(input_file_path)
Reads in a .nml
file with a slurm_info
section, containing information about python script to run on slurm.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_file_path
|
str
|
The |
required |
Returns:
Name | Type | Description |
---|---|---|
info |
dict
|
Dictionary containing all entries in |
Source code in isca_tools/jasmin/run/base.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
get_unique_dir_name(base_dir)
Return a unique directory name by appending a number if needed. E.g., 'results', 'results_1', 'results_2', ...
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_dir
|
str
|
Path to directory |
required |
Returns:
Name | Type | Description |
---|---|---|
base_dir |
str
|
Unique directory name |
Source code in isca_tools/jasmin/run/base.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
import_func_from_path(script_path, func_name='main', module_name='my_dynamic_module')
Loads in the function called func_name
from script_path
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
script_path
|
str
|
Path to python |
required |
func_name
|
str
|
Function name to import. |
'main'
|
module_name
|
str
|
Temporary name for module being loaded dynamically. Could be anything. |
'my_dynamic_module'
|
Returns:
Name | Type | Description |
---|---|---|
func |
Optional[Callable]
|
Desired function, or |
Source code in isca_tools/jasmin/run/base.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
run_script(script_path=None, script_args=None, job_name=None, time='02:00:00', n_tasks=1, cpus_per_task=1, mem=16, partition='standard', qos=None, account='global_ex', conda_env='myenv', exist_output_ok=None, input_file_path=None, slurm=False, dependent_job_id=None)
Function to submit a python script located at script_path
to JASMIN using Slurm.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
script_path
|
Optional[str]
|
Path of python script to run. |
None
|
script_args
|
Optional[Union[List, float, int, str]]
|
Arguments to be passed to |
None
|
job_name
|
Optional[str]
|
Name of job submitted to slurm. If not provided, will set to name of python script without |
None
|
time
|
str
|
Maximum wall time for your job in format |
'02:00:00'
|
n_tasks
|
int
|
Number of tasks to run (usually 1 for a single script). |
1
|
cpus_per_task
|
int
|
How many CPUs to allocate per task. |
1
|
mem
|
Union[float, int]
|
Memory to allocate for the job in GB. |
16
|
partition
|
str
|
Specifies the partition for the job.
Options
are |
'standard'
|
qos
|
Optional[str]
|
Quality of service
examples
include |
None
|
conda_env
|
str
|
Name of the conda environment on JASMIN to use. |
'myenv'
|
account
|
str
|
Account to use for submitting jobs. Should be able to find as a group workspace in the myservices section of your JASMIN account. |
'global_ex'
|
exist_output_ok
|
Optional[bool]
|
Whether to run script if console_output for |
None
|
input_file_path
|
Optional[str]
|
Give option to provide nml file containing all Slurm info within |
None
|
slurm
|
bool
|
If |
False
|
dependent_job_id
|
Optional[str]
|
Job should only run after job with this dependency has finished. Only makes a difference
if |
None
|
Source code in isca_tools/jasmin/run/base.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|