yaml_workflow.workspace¶
yaml_workflow.workspace
¶
Workspace management for workflow execution.
Classes¶
BatchState
¶
Manages batch processing state.
Source code in src/yaml_workflow/workspace.py
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 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
|
Functions¶
get_stats() -> Dict[str, int]
¶
Get processing statistics.
Returns:
Type | Description |
---|---|
Dict[str, int]
|
Dict containing processing statistics |
mark_failed(item: Any, error: str) -> None
¶
Mark an item as failed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item
|
Any
|
The failed item |
required |
error
|
str
|
Error message |
required |
Source code in src/yaml_workflow/workspace.py
mark_processed(item: Any, result: Dict[str, Any]) -> None
¶
Mark an item as successfully processed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item
|
Any
|
The processed item |
required |
result
|
Dict[str, Any]
|
Processing result |
required |
Source code in src/yaml_workflow/workspace.py
mark_template_error(item: Any, error: str) -> None
¶
Mark an item as having a template error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item
|
Any
|
The item with template error |
required |
error
|
str
|
Template error message |
required |
Source code in src/yaml_workflow/workspace.py
reset() -> None
¶
Reset batch state.
Source code in src/yaml_workflow/workspace.py
save() -> None
¶
update_namespace(namespace: str, data: Dict[str, Any]) -> None
¶
Update namespace data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
namespace
|
str
|
Name of the namespace |
required |
data
|
Dict[str, Any]
|
Namespace data to update |
required |
Source code in src/yaml_workflow/workspace.py
Functions¶
create_workspace(workflow_name: str, custom_dir: Optional[str] = None, base_dir: str = 'runs') -> Path
¶
Create a workspace directory for a workflow run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workflow_name
|
str
|
Name of the workflow |
required |
custom_dir
|
Optional[str]
|
Optional custom directory path |
None
|
base_dir
|
str
|
Base directory for workflow runs |
'runs'
|
Returns:
Name | Type | Description |
---|---|---|
Path |
Path
|
Path to the workspace directory |
Source code in src/yaml_workflow/workspace.py
get_next_run_number(base_dir: Path, workflow_name: str) -> int
¶
Get the next available run number for a workflow by checking existing run directories.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_dir
|
Path
|
Base directory containing workflow runs |
required |
workflow_name
|
str
|
Name of the workflow |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Next available run number |
Source code in src/yaml_workflow/workspace.py
get_run_number_from_metadata(workspace: Path) -> Optional[int]
¶
Get run number from workspace metadata file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workspace
|
Path
|
Workspace directory |
required |
Returns:
Type | Description |
---|---|
Optional[int]
|
Optional[int]: Run number if found in metadata, None otherwise |
Source code in src/yaml_workflow/workspace.py
get_workspace_info(workspace: Path) -> Dict[str, Any]
¶
Get information about a workspace.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workspace
|
Path
|
Workspace directory |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
Dict[str, Any]
|
Workspace information |
Source code in src/yaml_workflow/workspace.py
resolve_path(workspace: Path, file_path: str) -> Path
¶
Resolve a file path relative to the workspace directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workspace
|
Path
|
Workspace directory |
required |
file_path
|
str
|
File path to resolve |
required |
Returns:
Name | Type | Description |
---|---|---|
Path |
Path
|
Resolved absolute path |
Handles paths: 1. If path is absolute, return it as is. 2. If path is relative, join it with the workspace root. Users should include prefixes like 'output/', 'logs/', 'temp/' explicitly if needed.
Source code in src/yaml_workflow/workspace.py
sanitize_name(name: str) -> str
¶
Sanitize a name for use in file paths.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name to sanitize |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Sanitized name |
Source code in src/yaml_workflow/workspace.py
save_metadata(workspace: Path, metadata: Dict[str, Any]) -> None
¶
Save metadata to the workspace directory.