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
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
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
436 437 438 439 440 441 442 443 444 445 446 447 | |
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
602 603 604 605 606 607 608 609 610 611 | |
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
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
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
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
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
409 410 411 412 413 414 415 | |
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
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 548 549 550 551 552 553 554 555 | |
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
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
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
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 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
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
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 | |
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
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
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
436 437 438 439 440 441 442 443 444 445 446 447 | |
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
602 603 604 605 606 607 608 609 610 611 | |
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
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
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
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
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
409 410 411 412 413 414 415 | |
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
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 548 549 550 551 552 553 554 555 | |
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
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
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
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 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
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
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 | |
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
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
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
436 437 438 439 440 441 442 443 444 445 446 447 | |
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
602 603 604 605 606 607 608 609 610 611 | |
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
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
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
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
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
409 410 411 412 413 414 415 | |
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
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 548 549 550 551 552 553 554 555 | |
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
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
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
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 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
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
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 | |
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
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
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
436 437 438 439 440 441 442 443 444 445 446 447 | |
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
602 603 604 605 606 607 608 609 610 611 | |
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
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
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
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
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
409 410 411 412 413 414 415 | |
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
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | |
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
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
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
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 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
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
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 | |
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
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 | |
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
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
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
436 437 438 439 440 441 442 443 444 445 446 447 | |
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
602 603 604 605 606 607 608 609 610 611 | |
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
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
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
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
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
409 410 411 412 413 414 415 | |
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
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 548 549 550 551 552 553 554 555 | |
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
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
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
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 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
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
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 | |
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
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
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
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
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
295 296 297 298 299 300 301 302 | |
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
264 265 266 267 268 269 270 271 272 273 274 | |
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
27 28 29 30 31 32 33 34 35 36 37 | |
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
39 40 41 42 43 44 45 | |
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
69 70 71 72 73 74 75 76 77 78 79 80 | |
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
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 | |
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
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 | |
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
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 | |
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
119 120 121 122 123 124 125 126 127 128 129 130 131 | |
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
108 109 110 111 112 113 114 115 116 117 | |