data_transfer.aind_watchdog¶
WatchdogSettings ¶
Bases: ServiceSettings
Settings for the WatchdogDataTransferService.
Configures data transfer operations including destination paths, scheduling, and integration with the AIND watchdog service.
settings_customise_sources
classmethod
¶
settings_customise_sources(
settings_cls: Type[BaseSettings],
init_settings: PydanticBaseSettingsSource,
env_settings: PydanticBaseSettingsSource,
dotenv_settings: PydanticBaseSettingsSource,
file_secret_settings: PydanticBaseSettingsSource,
) -> Tuple[PydanticBaseSettingsSource, ...]
Customizes the settings sources to include the safe YAML settings source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings_cls
|
Type[BaseSettings]
|
The settings class |
required |
init_settings
|
PydanticBaseSettingsSource
|
The initial settings source |
required |
env_settings
|
PydanticBaseSettingsSource
|
The environment settings source |
required |
dotenv_settings
|
PydanticBaseSettingsSource
|
The dotenv settings source |
required |
file_secret_settings
|
PydanticBaseSettingsSource
|
The file secret settings source |
required |
Returns:
| Type | Description |
|---|---|
Tuple[PydanticBaseSettingsSource, ...]
|
Tuple[PydanticBaseSettingsSource, ...]: A tuple of settings sources |
Source code in src/clabe/services.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
WatchdogDataTransferService ¶
WatchdogDataTransferService(
source: PathLike | list[PathLike],
settings: WatchdogSettings,
session: Session,
*,
validate: bool = True,
email_from_experimenter_builder: Optional[
Callable[[str], str]
] = lambda user_name: f"{user_name}@alleninstitute.org",
)
Bases: DataTransfer[WatchdogSettings]
A data transfer service that uses the aind-watchdog-service to monitor and transfer data.
Integrates with the AIND data transfer infrastructure to automatically monitor directories for new data and transfer it to specified destinations with proper metadata handling and validation.
Methods:
| Name | Description |
|---|---|
transfer |
Executes the data transfer by generating a manifest configuration |
validate |
Validates the Watchdog service and its configuration |
is_valid_project_name |
Checks if the project name is valid |
is_running |
Checks if the Watchdog service is currently running |
force_restart |
Attempts to restart the Watchdog application |
dump_manifest_config |
Dumps the manifest configuration to a YAML file |
prompt_input |
Prompts the user to confirm manifest generation |
Initializes the WatchdogDataTransferService.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
PathLike | list[PathLike]
|
The source directory or file to monitor |
required |
settings
|
WatchdogSettings
|
Configuration for the watchdog service |
required |
session
|
Session
|
The session data from aind-behavior-services |
required |
validate
|
bool
|
Whether to validate the project name |
True
|
session_name
|
Name of the session |
required | |
email_from_experimenter_builder
|
Optional[Callable[[str], str]]
|
Function to build email from experimenter name |
lambda user_name: f'{user_name}@alleninstitute.org'
|
Source code in src/clabe/data_transfer/aind_watchdog.py
75 76 77 78 79 80 81 82 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 | |
settings
property
¶
settings: TSettings
Returns the settings for the data transfer service.
Returns:
| Name | Type | Description |
|---|---|---|
TSettings |
TSettings
|
The service settings |
transfer ¶
transfer() -> None
Executes the data transfer by generating a Watchdog manifest configuration.
Creates and deploys a manifest configuration file that the watchdog service will use to monitor and transfer data.
Source code in src/clabe/data_transfer/aind_watchdog.py
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 | |
validate ¶
validate() -> bool
Validates the Watchdog service and its configuration.
Checks for required executables, configuration files, service status, and project name validity.
Returns:
| Type | Description |
|---|---|
bool
|
True if the service is valid, False otherwise |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If required files are missing |
HTTPError
|
If the project name validation fails |
Source code in src/clabe/data_transfer/aind_watchdog.py
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 | |
is_valid_project_name ¶
is_valid_project_name() -> bool
Checks if the project name is valid by querying the metadata service.
Returns:
| Type | Description |
|---|---|
bool
|
True if the project name is valid, False otherwise |
Source code in src/clabe/data_transfer/aind_watchdog.py
203 204 205 206 207 208 209 210 211 | |
is_running ¶
is_running() -> bool
Checks if the Watchdog service is currently running.
Returns:
| Type | Description |
|---|---|
bool
|
True if the service is running, False otherwise |
Source code in src/clabe/data_transfer/aind_watchdog.py
454 455 456 457 458 459 460 461 462 463 464 465 | |
force_restart ¶
Attempts to restart the Watchdog application.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kill_if_running
|
bool
|
Whether to terminate the service if it's already running |
True
|
Returns:
| Type | Description |
|---|---|
Popen[bytes]
|
A subprocess.Popen object representing the restarted service |
Source code in src/clabe/data_transfer/aind_watchdog.py
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
dump_manifest_config ¶
Dumps the manifest configuration to a YAML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Optional[PathLike]
|
The file path to save the manifest |
None
|
make_dir
|
bool
|
Whether to create the directory if it doesn't exist |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
The path to the saved manifest file |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the manifest or watch configuration is not set |
Source code in src/clabe/data_transfer/aind_watchdog.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | |