Pipeline API Reference
CommonWorker
CommonWorker(worker_id: str, worker_url: str, repo_url: str | None = None)
Common class for all the SightHouse pipeline workers
Parameters:
-
(worker_idstr) –Unique identifier for the worker.
-
(worker_urlstr) –Celery broker/backend URL.
-
(repo_urlstr, default:None) –Optional url for the repo.
- API Reference Pipeline API Reference
Methods:
-
delete_file–Deletes the specified file from either local filesystem or S3.
-
do_work–Defines the actual processing behavior for a Job instance.
-
get_file–Retrieves the content of the specified file from either local filesystem or S3.
-
get_sharefile–Returns the path or URL for sharing the file.
-
log–Log a message using worker's logger
-
pack_and_send_task–Wrapper method that will pack the given files into an archive, upload it onto the
-
push_file–Pushes or uploads a file to the specified path in either local filesystem or S3.
-
run–Runs the Celery worker and registers the processing task.
-
send_task–Sends the job to the next worker in the chain.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
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 | |
delete_file
delete_file(upload_path: str) -> None
Deletes the specified file from either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path of the file to be deleted.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
460 461 462 463 464 465 466 467 468 469 470 471 | |
do_work
Defines the actual processing behavior for a Job instance.
Parameters:
-
(jobJob) –The Job instance to process.
Raises:
-
NotImplementedError–If not overridden in subclasses.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
633 634 635 636 637 638 639 640 641 642 | |
get_file
get_file(upload_path: str) -> Optional[bytes]
Retrieves the content of the specified file from either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path of the file to be retrieved.
Returns:
-
Optional[bytes]–bytes | None: The content of the file if found, otherwise None.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | |
get_sharefile
get_sharefile(upload_path: str) -> Path | str
Returns the path or URL for sharing the file.
Parameters:
-
(upload_pathstr) –The path of the file to be shared.
Returns:
-
Path | str–Path | str: A POSIX absolute path if local, a pre-signed URL if S3.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
log
log(message: str, *args, **kwargs) -> None
Log a message using worker's logger
Parameters:
-
(messagestr) –The message to log
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
433 434 435 436 437 438 439 | |
pack_and_send_task
pack_and_send_task(job: Job, files: Sequence[Union[Path, str]], name: Optional[str] = None, step: Optional[str] = None) -> None
Wrapper method that will pack the given files into an archive, upload it onto the worker repository and send the given Job to the next worker in the execution chain.
Parameters:
-
(jobJob) –(Job): The job to update and send
-
(filesSequence[Union[Path, str]]) –List of path like to upload
-
(nameOptional[str], default:None) –Optional name for the packed files
-
(stepOptional[str], default:None) –Optional substep to target a specific step
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | |
push_file
push_file(upload_path: str, content: bytes) -> bool
Pushes or uploads a file to the specified path in either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path where the file should be uploaded.
-
(contentbytes) –The content of the file to be uploaded.
Returns:
-
bool(bool) –True if successful, False otherwise.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
run
run(concurrent_task: int = 1) -> None
Runs the Celery worker and registers the processing task.
Parameters:
-
(concurrent_taskint, default:1) –Number of concurrent tasks to process.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
send_task
Sends the job to the next worker in the chain.
Parameters:
-
(jobJob) –The Job instance to forward.
-
(stepstr, default:None) –Optional step to target a specific worker.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
Scrapper
Scrapper(worker_id: str, worker_url: str, repo_url: str | None = None)
Bases: CommonWorker
SightHouse scrapper worker
Parameters:
-
(worker_idstr) –Unique identifier for the worker.
-
(worker_urlstr) –Celery broker/backend URL.
-
(repo_urlstr, default:None) –Optional url for the repo.
Methods:
-
delete_file–Deletes the specified file from either local filesystem or S3.
-
do_work–Defines the actual processing behavior for a Job instance.
-
get_file–Retrieves the content of the specified file from either local filesystem or S3.
-
get_sharefile–Returns the path or URL for sharing the file.
-
log–Log a message using worker's logger
-
pack_and_send_task–Wrapper method that will pack the given files into an archive, upload it onto the
-
push_file–Pushes or uploads a file to the specified path in either local filesystem or S3.
-
run–Runs the Celery worker and registers the processing task.
-
send_task–Sends the job to the next worker in the chain.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
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 | |
delete_file
delete_file(upload_path: str) -> None
Deletes the specified file from either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path of the file to be deleted.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
460 461 462 463 464 465 466 467 468 469 470 471 | |
do_work
Defines the actual processing behavior for a Job instance.
Parameters:
-
(jobJob) –The Job instance to process.
Raises:
-
NotImplementedError–If not overridden in subclasses.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
633 634 635 636 637 638 639 640 641 642 | |
get_file
get_file(upload_path: str) -> Optional[bytes]
Retrieves the content of the specified file from either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path of the file to be retrieved.
Returns:
-
Optional[bytes]–bytes | None: The content of the file if found, otherwise None.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | |
get_sharefile
get_sharefile(upload_path: str) -> Path | str
Returns the path or URL for sharing the file.
Parameters:
-
(upload_pathstr) –The path of the file to be shared.
Returns:
-
Path | str–Path | str: A POSIX absolute path if local, a pre-signed URL if S3.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
log
log(message: str, *args, **kwargs) -> None
Log a message using worker's logger
Parameters:
-
(messagestr) –The message to log
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
433 434 435 436 437 438 439 | |
pack_and_send_task
pack_and_send_task(job: Job, files: Sequence[Union[Path, str]], name: Optional[str] = None, step: Optional[str] = None) -> None
Wrapper method that will pack the given files into an archive, upload it onto the worker repository and send the given Job to the next worker in the execution chain.
Parameters:
-
(jobJob) –(Job): The job to update and send
-
(filesSequence[Union[Path, str]]) –List of path like to upload
-
(nameOptional[str], default:None) –Optional name for the packed files
-
(stepOptional[str], default:None) –Optional substep to target a specific step
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | |
push_file
push_file(upload_path: str, content: bytes) -> bool
Pushes or uploads a file to the specified path in either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path where the file should be uploaded.
-
(contentbytes) –The content of the file to be uploaded.
Returns:
-
bool(bool) –True if successful, False otherwise.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
run
run(concurrent_task: int = 1) -> None
Runs the Celery worker and registers the processing task.
Parameters:
-
(concurrent_taskint, default:1) –Number of concurrent tasks to process.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
send_task
Sends the job to the next worker in the chain.
Parameters:
-
(jobJob) –The Job instance to forward.
-
(stepstr, default:None) –Optional step to target a specific worker.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
Preprocessor
Preprocessor(worker_id: str, worker_url: str, repo_url: str | None = None)
Bases: CommonWorker
SightHouse preprocessor worker
Parameters:
-
(worker_idstr) –Unique identifier for the worker.
-
(worker_urlstr) –Celery broker/backend URL.
-
(repo_urlstr, default:None) –Optional url for the repo.
Methods:
-
delete_file–Deletes the specified file from either local filesystem or S3.
-
do_work–Defines the actual processing behavior for a Job instance.
-
get_file–Retrieves the content of the specified file from either local filesystem or S3.
-
get_sharefile–Returns the path or URL for sharing the file.
-
log–Log a message using worker's logger
-
pack_and_send_task–Wrapper method that will pack the given files into an archive, upload it onto the
-
push_file–Pushes or uploads a file to the specified path in either local filesystem or S3.
-
run–Runs the Celery worker and registers the processing task.
-
send_task–Sends the job to the next worker in the chain.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
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 | |
delete_file
delete_file(upload_path: str) -> None
Deletes the specified file from either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path of the file to be deleted.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
460 461 462 463 464 465 466 467 468 469 470 471 | |
do_work
Defines the actual processing behavior for a Job instance.
Parameters:
-
(jobJob) –The Job instance to process.
Raises:
-
NotImplementedError–If not overridden in subclasses.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
633 634 635 636 637 638 639 640 641 642 | |
get_file
get_file(upload_path: str) -> Optional[bytes]
Retrieves the content of the specified file from either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path of the file to be retrieved.
Returns:
-
Optional[bytes]–bytes | None: The content of the file if found, otherwise None.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | |
get_sharefile
get_sharefile(upload_path: str) -> Path | str
Returns the path or URL for sharing the file.
Parameters:
-
(upload_pathstr) –The path of the file to be shared.
Returns:
-
Path | str–Path | str: A POSIX absolute path if local, a pre-signed URL if S3.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
log
log(message: str, *args, **kwargs) -> None
Log a message using worker's logger
Parameters:
-
(messagestr) –The message to log
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
433 434 435 436 437 438 439 | |
pack_and_send_task
pack_and_send_task(job: Job, files: Sequence[Union[Path, str]], name: Optional[str] = None, step: Optional[str] = None) -> None
Wrapper method that will pack the given files into an archive, upload it onto the worker repository and send the given Job to the next worker in the execution chain.
Parameters:
-
(jobJob) –(Job): The job to update and send
-
(filesSequence[Union[Path, str]]) –List of path like to upload
-
(nameOptional[str], default:None) –Optional name for the packed files
-
(stepOptional[str], default:None) –Optional substep to target a specific step
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | |
push_file
push_file(upload_path: str, content: bytes) -> bool
Pushes or uploads a file to the specified path in either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path where the file should be uploaded.
-
(contentbytes) –The content of the file to be uploaded.
Returns:
-
bool(bool) –True if successful, False otherwise.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
run
run(concurrent_task: int = 1) -> None
Runs the Celery worker and registers the processing task.
Parameters:
-
(concurrent_taskint, default:1) –Number of concurrent tasks to process.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
send_task
Sends the job to the next worker in the chain.
Parameters:
-
(jobJob) –The Job instance to forward.
-
(stepstr, default:None) –Optional step to target a specific worker.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
Compiler
Compiler(worker_id: str, worker_url: str, repo_url: str | None = None)
Bases: CommonWorker
SightHouse compiler worker
Parameters:
-
(worker_idstr) –Unique identifier for the worker.
-
(worker_urlstr) –Celery broker/backend URL.
-
(repo_urlstr, default:None) –Optional url for the repo.
Methods:
-
delete_file–Deletes the specified file from either local filesystem or S3.
-
do_work–Defines the actual processing behavior for a Job instance.
-
get_file–Retrieves the content of the specified file from either local filesystem or S3.
-
get_sharefile–Returns the path or URL for sharing the file.
-
log–Log a message using worker's logger
-
pack_and_send_task–Wrapper method that will pack the given files into an archive, upload it onto the
-
push_file–Pushes or uploads a file to the specified path in either local filesystem or S3.
-
run–Runs the Celery worker and registers the processing task.
-
send_task–Sends the job to the next worker in the chain.
-
validate_compiler_variants–Validate compiler_variants structure.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
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 | |
delete_file
delete_file(upload_path: str) -> None
Deletes the specified file from either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path of the file to be deleted.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
460 461 462 463 464 465 466 467 468 469 470 471 | |
do_work
Defines the actual processing behavior for a Job instance.
Parameters:
-
(jobJob) –The Job instance to process.
Raises:
-
NotImplementedError–If not overridden in subclasses.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
633 634 635 636 637 638 639 640 641 642 | |
get_file
get_file(upload_path: str) -> Optional[bytes]
Retrieves the content of the specified file from either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path of the file to be retrieved.
Returns:
-
Optional[bytes]–bytes | None: The content of the file if found, otherwise None.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | |
get_sharefile
get_sharefile(upload_path: str) -> Path | str
Returns the path or URL for sharing the file.
Parameters:
-
(upload_pathstr) –The path of the file to be shared.
Returns:
-
Path | str–Path | str: A POSIX absolute path if local, a pre-signed URL if S3.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
log
log(message: str, *args, **kwargs) -> None
Log a message using worker's logger
Parameters:
-
(messagestr) –The message to log
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
433 434 435 436 437 438 439 | |
pack_and_send_task
pack_and_send_task(job: Job, files: Sequence[Union[Path, str]], metadata: List[Tuple[str, str]], name: Optional[str] = None, step: Optional[str] = None) -> None
Wrapper method that will pack the given files into an archive, upload it onto the worker repository and send the given Job to the next worker in the execution chain.
Parameters:
-
(jobJob) –(Job): The job to update and send
-
(filesSequence[Union[Path, str]]) –List of path like to upload
-
(metadataList[Tuple[str, str]]) –List of metadata to send to the analyzer
-
(nameOptional[str], default:None) –Optional name for the packed files
-
(stepOptional[str], default:None) –Optional substep to target a specific step
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | |
push_file
push_file(upload_path: str, content: bytes) -> bool
Pushes or uploads a file to the specified path in either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path where the file should be uploaded.
-
(contentbytes) –The content of the file to be uploaded.
Returns:
-
bool(bool) –True if successful, False otherwise.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
run
run(concurrent_task: int = 1) -> None
Runs the Celery worker and registers the processing task.
Parameters:
-
(concurrent_taskint, default:1) –Number of concurrent tasks to process.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
send_task
Sends the job to the next worker in the chain.
Parameters:
-
(jobJob) –The Job instance to forward.
-
(stepstr, default:None) –Optional step to target a specific worker.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
validate_compiler_variants
staticmethod
validate_compiler_variants(data: Dict[str, Dict[str, Any]]) -> List[Tuple[str, Dict[str, str]]]
Validate compiler_variants structure.
Parameters:
-
(datadict) –Dictionary of compiler_variants to validate.
Returns:
-
List[Tuple[str, Dict[str, str]]]–list[tuple[str, str]]: The list of compiler_variants.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 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 | |
Analyzer
Analyzer(worker_id: str, worker_url: str, repo_url: str | None = None)
Bases: CommonWorker
SightHouse analyzer worker
Parameters:
-
(worker_idstr) –Unique identifier for the worker.
-
(worker_urlstr) –Celery broker/backend URL.
-
(repo_urlstr, default:None) –Optional url for the repo.
Methods:
-
delete_file–Deletes the specified file from either local filesystem or S3.
-
do_work–Defines the actual processing behavior for a Job instance.
-
get_file–Retrieves the content of the specified file from either local filesystem or S3.
-
get_sharefile–Returns the path or URL for sharing the file.
-
log–Log a message using worker's logger
-
pack_and_send_task–Wrapper method that will pack the given files into an archive, upload it onto the
-
push_file–Pushes or uploads a file to the specified path in either local filesystem or S3.
-
run–Runs the Celery worker and registers the processing task.
-
send_task–Sends the job to the next worker in the chain.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
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 | |
delete_file
delete_file(upload_path: str) -> None
Deletes the specified file from either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path of the file to be deleted.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
460 461 462 463 464 465 466 467 468 469 470 471 | |
do_work
Defines the actual processing behavior for a Job instance.
Parameters:
-
(jobJob) –The Job instance to process.
Raises:
-
NotImplementedError–If not overridden in subclasses.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
633 634 635 636 637 638 639 640 641 642 | |
get_file
get_file(upload_path: str) -> Optional[bytes]
Retrieves the content of the specified file from either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path of the file to be retrieved.
Returns:
-
Optional[bytes]–bytes | None: The content of the file if found, otherwise None.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | |
get_sharefile
get_sharefile(upload_path: str) -> Path | str
Returns the path or URL for sharing the file.
Parameters:
-
(upload_pathstr) –The path of the file to be shared.
Returns:
-
Path | str–Path | str: A POSIX absolute path if local, a pre-signed URL if S3.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
log
log(message: str, *args, **kwargs) -> None
Log a message using worker's logger
Parameters:
-
(messagestr) –The message to log
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
433 434 435 436 437 438 439 | |
pack_and_send_task
pack_and_send_task(job: Job, files: Sequence[Union[Path, str]], name: Optional[str] = None, step: Optional[str] = None) -> None
Wrapper method that will pack the given files into an archive, upload it onto the worker repository and send the given Job to the next worker in the execution chain.
Parameters:
-
(jobJob) –(Job): The job to update and send
-
(filesSequence[Union[Path, str]]) –List of path like to upload
-
(nameOptional[str], default:None) –Optional name for the packed files
-
(stepOptional[str], default:None) –Optional substep to target a specific step
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | |
push_file
push_file(upload_path: str, content: bytes) -> bool
Pushes or uploads a file to the specified path in either local filesystem or S3.
Parameters:
-
(upload_pathstr) –The path where the file should be uploaded.
-
(contentbytes) –The content of the file to be uploaded.
Returns:
-
bool(bool) –True if successful, False otherwise.
Raises:
-
ValueError–If URI scheme is unsupported.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
run
run(concurrent_task: int = 1) -> None
Runs the Celery worker and registers the processing task.
Parameters:
-
(concurrent_taskint, default:1) –Number of concurrent tasks to process.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
send_task
Sends the job to the next worker in the chain.
Parameters:
-
(jobJob) –The Job instance to forward.
-
(stepstr, default:None) –Optional step to target a specific worker.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
Job
Job(execution_chain: ExecutionChain, job_metadata: Dict[str, Any], job_data: Dict[str, Any] | None = None)
Represents a job in an execution chain.
This class wraps the job's execution logic, data, and metadata. It supports serialization to and from a dictionary for persistence.
Parameters:
-
(execution_chainExecutionChain) –The job's execution steps or dependencies.
-
(job_metadataDict[str, Any]) –Metadata about the job such as id, predecessor, and state.
-
(job_dataDict[str, Any] | None, default:None) –The data associated with the job.
-
API Reference
Pipeline API Reference
Jobfrom_dict
Methods:
-
from_dict–Creates a Job instance from a dictionary.
-
get_next_worker_args–Gets the argument dictionaries for the next step(s) in sequence.
-
to_dict–Converts the Job instance into a dictionary.
Attributes:
-
package(Optional[str]) –Retrieves the package name for the current step.
-
worker_args(Dict[str, Any]) –Retrieves the argument dictionary for the current step.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
package
property
package: Optional[str]
Retrieves the package name for the current step.
Returns:
-
Optional[str]–Optional[str]: The package name of the module responsible for the current step,
-
Optional[str]–or None if unavailable.
worker_args
property
worker_args: Dict[str, Any]
Retrieves the argument dictionary for the current step.
Returns:
-
Dict[str, Any]–Dict[str, Any]: The arguments associated with the current step in the execution chain.
from_dict
classmethod
Creates a Job instance from a dictionary.
Parameters:
-
(dataDict[str, Any]) –The dictionary containing job data, structured as: { "execution_chain": {...}, "job_data": {...}, "job_metadata": {...} }
Returns:
-
Job(Job) –A new Job instance created from the given dictionary.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
get_next_worker_args
get_next_worker_args() -> List[Tuple[str, Dict[str, Any]]]
Gets the argument dictionaries for the next step(s) in sequence.
Returns:
-
List[Tuple[str, Dict[str, Any]]]–List[Tuple[str, Dict[str, Any]]]: A list of tuples containing each next step label
-
List[Tuple[str, Dict[str, Any]]]–and its corresponding argument dictionary.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
307 308 309 310 311 312 313 314 | |
to_dict
to_dict() -> Dict[str, Any]
Converts the Job instance into a dictionary.
Returns:
-
Dict[str, Any]–Dict[str, Any]: The dictionary representation of the Job.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
276 277 278 279 280 281 282 283 284 285 286 | |
ExecutionStep
Represent a step in the execution chain of a Job
Parameters:
-
(packagestr) –The name of the package containing the step.
-
(argsDict[str, Any]) –The arguments required for executing the step.
-
(stepstr) –The name of the step.
-
API Reference
Pipeline API Reference
ExecutionChain
-
API Reference
Pipeline API Reference
ExecutionChain
Methods:
-
to_dict–Converts the execution step to a dictionary representation.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
39 40 41 42 43 44 45 46 47 48 49 | |
to_dict
to_dict() -> Dict[str, Any]
Converts the execution step to a dictionary representation.
Returns:
-
Dict[str, Any]–Dict[str, Any]: A dictionary containing the step's package, arguments, and name.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
51 52 53 54 55 56 57 | |
ExecutionChain
ExecutionChain(execution_steps: List[ExecutionStep], current_step: Optional[str] = None)
Represents an ordered list of execution steps for a Job.
The class manages a sequential chain of ExecutionStep instances that define
the workflow of a job. It supports navigation between steps, retrieval of step
arguments, and advancement to the next logical set of steps.
Parameters:
-
(execution_stepsList[ExecutionStep]) –The sequence of steps to execute.
-
(current_stepOptional[str], default:None) –The label of the current step. Defaults to "1" if not provided.
-
API Reference
Pipeline API Reference
ExecutionChainfrom_dict
-
API Reference
Pipeline API Reference
Job
Methods:
-
advance_to_next_step–Advance to the next major step and return ALL its substeps.
-
from_dict–Creates an ExecutionChain instance from a dictionary representation.
-
get_next_worker_args–Retrieves arguments for the next main step(s) in the sequence.
-
get_step–Retrieves the specified execution step.
-
to_dict–Converts the execution chain to a dictionary representation.
Attributes:
-
package(Optional[str]) –Returns the package name associated with the current step.
-
worker_args(Dict[str, Any]) –Returns the argument dictionary for the current step.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
81 82 83 84 85 86 87 88 89 90 91 92 | |
package
property
package: Optional[str]
Returns the package name associated with the current step.
Returns:
-
Optional[str]–Optional[str]: The package name, or None if the current step does not exist.
worker_args
property
worker_args: Dict[str, Any]
Returns the argument dictionary for the current step.
Returns:
-
Dict[str, Any]–Dict[str, Any]: The arguments for the current step, or an empty dict if not found.
advance_to_next_step
advance_to_next_step() -> Optional[List[ExecutionStep]]
Advance to the next major step and return ALL its substeps.
- Moves from current position (e.g. "3.2") to next major step (e.g. "4")
- Sets
current_stepto first substep of that major step - Returns all substeps for that major step as a batch
Returns:
-
Optional[List[ExecutionStep]]–List[ExecutionStep]: All substeps of next major step, or None if complete.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
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 | |
from_dict
classmethod
from_dict(data: Dict[str, Any]) -> ExecutionChain
Creates an ExecutionChain instance from a dictionary representation.
Parameters:
-
(dataDict[str, Any]) –A dictionary containing step data and current step label. Expected format: { "execution_steps": [ {"package": str, "args": Dict[str, Any], "step": str}, ... ], "current_step": str }
Returns:
-
ExecutionChain(ExecutionChain) –A new instance built from the provided dictionary.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
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 | |
get_next_worker_args
get_next_worker_args() -> List[Tuple[str, Dict[str, Any]]]
Retrieves arguments for the next main step(s) in the sequence.
The method identifies the next major step (based on numeric prefixes) and collects the arguments for all substeps within that next step.
Returns:
-
List[Tuple[str, Dict[str, Any]]]–List[Tuple[str, Dict[str, Any]]]: A list of tuples where each tuple contains the
-
List[Tuple[str, Dict[str, Any]]]–step identifier and a copy of its argument dictionary. Returns an empty list if there
-
List[Tuple[str, Dict[str, Any]]]–are no subsequent steps.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
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 | |
get_step
get_step(step: str) -> Optional[ExecutionStep]
Retrieves the specified execution step.
Parameters:
-
(stepstr) –The identifier of the step to retrieve.
Returns:
-
Optional[ExecutionStep]–Optional[ExecutionStep]: The matching execution step, or None if not found.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
131 132 133 134 135 136 137 138 139 140 141 142 143 | |
to_dict
to_dict() -> Dict[str, Any]
Converts the execution chain to a dictionary representation.
Returns:
-
Dict[str, Any]–Dict[str, Any]: A dictionary describing all steps and the current step.
Source code in venv/lib/python3.12/site-packages/sighthouse/pipeline/worker.py
120 121 122 123 124 125 126 127 128 129 | |