rs_client/ogcapi/dpr_client.md
Use "DPR as a service" implemented by rs-dpr-service
ClusterInfo
dataclass
Information to connect to a DPR Dask cluster.
Attributes:
| Name | Type | Description |
|---|---|---|
jupyter_token |
str
|
JupyterHub API token. Only used in cluster mode, not local mode. |
cluster_label |
str
|
Dask cluster label e.g. "dask-l0" |
cluster_instance |
str | None
|
Dask cluster instance ID (something like "dask-gateway.17e196069443463495547eb97f532834"). |
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
DprClient
Bases: OgcApiClient
Implement the OGC API client for 'DPR as a service'.
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
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 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 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | |
endpoint_prefix
property
Return the endpoints prefix, if any.
href_service
property
Return the rs-dpr-service URL hostname. This URL can be overwritten using the RSPY_HOST_DPR_SERVICE env variable (used e.g. for local mode). Otherwise it should just be the RS-Server URL.
get_jobs()
Get all registered jobs with logging.
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
347 348 349 350 351 | |
get_process(process_id, cluster_info, **kwargs)
Call parent method with additional HTTP Get parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
process_id
|
str
|
name of the resource |
required |
cluster_info
|
ClusterInfo
|
Information to connect to a DPR Dask cluster |
required |
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
get_processes()
Get all defined processes with logging.
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
341 342 343 344 345 | |
run_conv_safe_zarr(payload, cluster_info)
Method to start the safe to zarr conversion process from rs-client - Call the endpoint /processes/conv_safe_zarr/execution
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict
|
Dictionary to pass to the processor, |
required |
cluster_info
|
ClusterInfo
|
Information to connect to a DPR Dask cluster |
required |
Return: job_id (int, str): Returns the status code of the request + the identifier (or None if endpoint fails) of the running job
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
run_process(process, cluster_info, s3_config_dir, payload_subpath, s3_report_dir, extra_data=None)
Method to start the process from rs-client - Call the endpoint /processes/{process}/execution
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
process
|
str
|
DPR process name |
required |
cluster_info
|
ClusterInfo
|
Information to connect to a DPR Dask cluster |
required |
s3_config_dir
|
str
|
S3 bucket folder that contains the payload and configuration files to pass to the processor |
required |
payload_subpath
|
str
|
Payload file path, relative to the config folder |
required |
s3_report_dir
|
str | None
|
S3 bucket folder were the processor report files will be written (optional). All the eopf |
required |
extra_data
|
dict | None
|
Extra data to pass to the processor. |
None
|
Return
job_id (int, str): Returns the status code of the request + the identifier (or None if endpoint fails) of the running job
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
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 | |
stream_logs(url, logger)
Streams and forwards server-sent event (SSE) logs for a processing job.
This method continuously connects to the job log streaming endpoint from rs-dpr-service and uses the provided logger to display log messages with their corresponding logging levels. Multi-line log entries are reconstructed before being logged. If the streaming connection is interrupted unexpectedly, the method automatically retries until the associated job reaches a terminal state or the log endpoint becomes unavailable.
The streaming loop stops when one of the following conditions is met
- the job reaches a terminal state ('successful', 'failed', or 'dismissed').
- the server closes the SSE connection after all logs have been sent.
- the log endpoint returns HTTP 404 indicating that the job id does not exist
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
URL of the SSE endpoint used to stream the job logs. |
required |
logger
|
Logger
|
Logger instance used to emit the streamed log messages. |
required |
Raises:
| Type | Description |
|---|---|
TODO
|
check the comment from except Exception in is_job_finished function. Maybe we |
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
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 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 | |
update_configuration(local_path, s3_path, is_payload=False, **kwargs)
async
Update local configuration file depending on the environment, upload it to the s3 bucket, and initialize output bucket folders.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
local_path
|
str | Path
|
Local configuration file path |
required |
s3_path
|
str | Path
|
S3 bucket path where to upload to modified updated configuration file |
required |
is_payload
|
bool
|
Specific behavior for the processor payload files |
False
|
kwargs
|
Specific environment variables to expand in the configuration file |
{}
|
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | |
wait_for_job(job_status, logger=None, job_name='', poll_interval=2)
Wait for job to finish.
Returns:
| Type | Description |
|---|---|
list[dict]
|
EOPF results |
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
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 | |
DprPipeline
Bases: str, Enum
DPR pipeline name
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
55 56 57 58 59 60 61 62 | |
DprProcessor
Bases: str, Enum
DPR processor name
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
44 45 46 47 48 49 50 51 | |
custom_cluster_info_repr(self)
Obfuscate the jupyter token in the string representation of the dataclass
Source code in docs/rs-client-libraries/rs_client/ogcapi/dpr_client.py
86 87 88 89 90 | |