radical.asyncflow.data¶
File ¶
File()
Base class for file handling in task execution systems.
Provides common attributes and functionality for managing files with filename and filepath properties.
Initialize a File object with default None values.
Sets filename and filepath attributes to None, to be populated by subclasses during file resolution.
Source code in doc_env/lib/python3.13/site-packages/radical/asyncflow/data.py
30 31 32 33 34 35 36 37 |
|
download_remote_url staticmethod
¶
download_remote_url(url: str) -> Path
Download a remote file to the current directory and return its full path.
Downloads file content from a remote URL using streaming to handle large files efficiently. Saves the file with a name derived from the URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url | str | The remote URL to download from. | required |
Returns:
Name | Type | Description |
---|---|---|
Path | Path | Absolute path to the downloaded file. |
Raises:
Type | Description |
---|---|
RequestException | If the download fails or URL is invalid. |
Example
::
1 2 |
|
Source code in doc_env/lib/python3.13/site-packages/radical/asyncflow/data.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
InputFile ¶
InputFile(file)
Bases: File
Represents an input file that can be sourced from remote URLs, local paths, or task outputs.
Automatically detects the file source type and handles appropriate resolution. Supports remote file downloading, local file path resolution, and task output file references.
Initialize an InputFile with automatic source type detection and resolution.
Determines whether the input is a remote URL, local file path, or reference to another task's output file, then resolves the appropriate file path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file | Input file specification. Can be: - Remote URL (http, https, ftp, s3, etc.) - Local file path (absolute or relative) - Task output file reference (filename for future resolution) | required |
Raises:
Type | Description |
---|---|
Exception | If file resolution fails or file source cannot be determined. |
Attributes:
Name | Type | Description |
---|---|---|
remote_url | str | URL if file is remote, None otherwise. |
local_file | str | Local path if file exists locally, None otherwise. |
other_task_file | str | Task reference if file is from another task, None otherwise. |
filepath | Path | Resolved file path. |
filename | str | Extracted filename from the resolved path. |
Source code in doc_env/lib/python3.13/site-packages/radical/asyncflow/data.py
83 84 85 86 87 88 89 90 91 92 93 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 |
|
download_remote_url staticmethod
¶
download_remote_url(url: str) -> Path
Download a remote file to the current directory and return its full path.
Downloads file content from a remote URL using streaming to handle large files efficiently. Saves the file with a name derived from the URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url | str | The remote URL to download from. | required |
Returns:
Name | Type | Description |
---|---|---|
Path | Path | Absolute path to the downloaded file. |
Raises:
Type | Description |
---|---|
RequestException | If the download fails or URL is invalid. |
Example
::
1 2 |
|
Source code in doc_env/lib/python3.13/site-packages/radical/asyncflow/data.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
OutputFile ¶
OutputFile(filename)
Bases: File
Represents an output file that will be produced by a task.
Handles filename validation and extraction from file paths, ensuring proper output file naming for task execution.
Initialize an OutputFile with filename validation.
Extracts the filename from the provided path and validates that it represents a valid file (not a directory or empty path).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename | The output filename or path. Can be a simple filename or a path, but must resolve to a valid filename. | required |
Raises:
Type | Description |
---|---|
ValueError | If filename is empty or resolves to an invalid file path. |
Attributes:
Name | Type | Description |
---|---|---|
filename | str | The extracted filename for the output file. |
Example
::
1 2 3 4 5 6 7 |
|
Source code in doc_env/lib/python3.13/site-packages/radical/asyncflow/data.py
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 |
|
download_remote_url staticmethod
¶
download_remote_url(url: str) -> Path
Download a remote file to the current directory and return its full path.
Downloads file content from a remote URL using streaming to handle large files efficiently. Saves the file with a name derived from the URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url | str | The remote URL to download from. | required |
Returns:
Name | Type | Description |
---|---|---|
Path | Path | Absolute path to the downloaded file. |
Raises:
Type | Description |
---|---|
RequestException | If the download fails or URL is invalid. |
Example
::
1 2 |
|
Source code in doc_env/lib/python3.13/site-packages/radical/asyncflow/data.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|