climate_ref.executor.local
#
ExecutionFuture
#
A container to hold the future and execution definition
Source code in packages/climate-ref/src/climate_ref/executor/local.py
LocalExecutor
#
Run a diagnostic locally using a process pool.
This performs the diagnostic executions in parallel using different processes.
The maximum number of processes is determined by the n parameter and default to the number of CPUs.
This executor is the default executor and is used when no other executor is specified.
Source code in packages/climate-ref/src/climate_ref/executor/local.py
94 95 96 97 98 99 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 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
join(timeout)
#
Wait for all diagnostics to finish
This will block until all diagnostics have completed or the timeout is reached. If the timeout is reached, the method will return and raise an exception.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float
|
Timeout in seconds |
required |
Raises:
| Type | Description |
|---|---|
TimeoutError
|
If the timeout is reached |
Source code in packages/climate-ref/src/climate_ref/executor/local.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
run(definition, execution=None)
#
Run a diagnostic in process
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definition
|
ExecutionDefinition
|
A description of the information needed for this execution of the diagnostic |
required |
execution
|
Execution | None
|
A database model representing the execution of the diagnostic. If provided, the result will be updated in the database when completed. |
None
|
Source code in packages/climate-ref/src/climate_ref/executor/local.py
process_result(config, database, result, execution)
#
Process the result of a diagnostic execution
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Config
|
The configuration object |
required |
database
|
Database
|
The database object |
required |
result
|
ExecutionResult
|
The result of the diagnostic execution. This could have either been a success or failure. |
required |
execution
|
Execution | None
|
A database model representing the execution of the diagnostic. |
required |