prefect.states
AwaitingConcurrencySlot(cls=State, scheduled_time=None, **kwargs)
Convenience function for creating AwaitingConcurrencySlot
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a AwaitingConcurrencySlot state |
Source code in src/prefect/states.py
745 746 747 748 749 750 751 752 753 754 755 756 757 |
|
AwaitingRetry(cls=State, scheduled_time=None, **kwargs)
Convenience function for creating AwaitingRetry
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a AwaitingRetry state |
Source code in src/prefect/states.py
730 731 732 733 734 735 736 737 738 739 740 741 742 |
|
Cancelled(cls=State, **kwargs)
Convenience function for creating Cancelled
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a Cancelled state |
Source code in src/prefect/states.py
653 654 655 656 657 658 659 |
|
Cancelling(cls=State, **kwargs)
Convenience function for creating Cancelling
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a Cancelling state |
Source code in src/prefect/states.py
644 645 646 647 648 649 650 |
|
Completed(cls=State, **kwargs)
Convenience function for creating Completed
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a Completed state |
Source code in src/prefect/states.py
608 609 610 611 612 613 614 |
|
Crashed(cls=State, **kwargs)
Convenience function for creating Crashed
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a Crashed state |
Source code in src/prefect/states.py
635 636 637 638 639 640 641 |
|
Failed(cls=State, **kwargs)
Convenience function for creating Failed
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a Failed state |
Source code in src/prefect/states.py
626 627 628 629 630 631 632 |
|
Late(cls=State, scheduled_time=None, **kwargs)
Convenience function for creating Late
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a Late state |
Source code in src/prefect/states.py
769 770 771 772 773 774 775 776 777 778 779 |
|
Paused(cls=State, timeout_seconds=None, pause_expiration_time=None, reschedule=False, pause_key=None, **kwargs)
Convenience function for creating Paused
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a Paused state |
Source code in src/prefect/states.py
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 |
|
Pending(cls=State, **kwargs)
Convenience function for creating Pending
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a Pending state |
Source code in src/prefect/states.py
662 663 664 665 666 667 668 |
|
Retrying(cls=State, **kwargs)
Convenience function for creating Retrying
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a Retrying state |
Source code in src/prefect/states.py
760 761 762 763 764 765 766 |
|
Running(cls=State, **kwargs)
Convenience function for creating Running
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a Running state |
Source code in src/prefect/states.py
617 618 619 620 621 622 623 |
|
Scheduled(cls=State, scheduled_time=None, **kwargs)
Convenience function for creating Scheduled
states.
Returns:
Name | Type | Description |
---|---|---|
State |
State[R]
|
a Scheduled state |
Source code in src/prefect/states.py
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 |
|
Suspended(cls=State, timeout_seconds=None, pause_expiration_time=None, pause_key=None, **kwargs)
Convenience function for creating Suspended
states.
Returns:
Name | Type | Description |
---|---|---|
State |
a Suspended state |
Source code in src/prefect/states.py
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 |
|
exception_to_crashed_state(exc, result_store=None)
async
Takes an exception that occurs outside of user code and converts it to a 'Crash' exception with a 'Crashed' state.
Source code in src/prefect/states.py
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 |
|
exception_to_failed_state(exc=None, result_store=None, write_result=False, **kwargs)
async
Convenience function for creating Failed
states from exceptions
Source code in src/prefect/states.py
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 |
|
get_state_exception(state)
async
If not given a FAILED or CRASHED state, this raise a value error.
If the state result is a state, its exception will be returned.
If the state result is an iterable of states, the exception of the first failure will be returned.
If the state result is a string, a wrapper exception will be returned with the string as the message.
If the state result is null, a wrapper exception will be returned with the state message attached.
If the state result is not of a known type, a TypeError
will be returned.
When a wrapper exception is returned, the type will be:
- FailedRun
if the state type is FAILED.
- CrashedRun
if the state type is CRASHED.
- CancelledRun
if the state type is CANCELLED.
Source code in src/prefect/states.py
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 |
|
get_state_result(state, raise_on_failure=True, fetch=True, retry_result_failure=True)
Get the result from a state.
See State.result()
Source code in src/prefect/states.py
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 74 75 76 77 78 79 80 |
|
is_state_iterable(obj)
Check if a the given object is an iterable of states types
Supported iterables are: - set - list - tuple
Other iterables will return False
even if they contain states.
Source code in src/prefect/states.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 |
|
raise_state_exception(state)
async
Given a FAILED or CRASHED state, raise the contained exception.
Source code in src/prefect/states.py
501 502 503 504 505 506 507 508 509 |
|
return_value_to_state(retval, result_store, key=None, expiration=None, write_result=False)
async
Given a return value from a user's function, create a State
the run should
be placed in.
- If data is returned, we create a 'COMPLETED' state with the data
- If a single, manually created state is returned, we use that state as given (manual creation is determined by the lack of ids)
- If an upstream state or iterable of upstream states is returned, we apply the aggregate rule
The aggregate rule says that given multiple states we will determine the final state such that:
- If any states are not COMPLETED the final state is FAILED
- If all of the states are COMPLETED the final state is COMPLETED
- The states will be placed in the final state
data
attribute
Callers should resolve all futures into states before passing return values to this function.
Source code in src/prefect/states.py
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 |
|