phase6-Prefect
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
"""CLI entry point: `python -m jobsource.main`.
|
||||
"""CLI entry point: ``python -m jobsource.main``.
|
||||
|
||||
Scaffold stub. Argument parsing is wired so `--help` works; the actual batch
|
||||
run lands in a later step (see jobsource/pipeline.py). Imports only stdlib so
|
||||
`--help` works before the heavier dependencies are installed.
|
||||
Parses arguments and delegates to :func:`~jobsource.pipeline.run_batch`.
|
||||
All heavy imports are deferred past the argument parse so ``--help`` exits
|
||||
immediately with no dependency overhead.
|
||||
|
||||
Usage examples::
|
||||
|
||||
python -m jobsource.main --help
|
||||
python -m jobsource.main --batch-size 20 --search "software engineer" --location "United States"
|
||||
python -m jobsource.main --search "data engineer" --search "ML engineer" --hours-old 48
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
|
||||
|
||||
@@ -46,6 +53,15 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
args = build_parser().parse_args(argv)
|
||||
|
||||
# Configure root logger so pipeline/cascade INFO and WARNING messages are
|
||||
# visible on the terminal. Deferred past parse_args so --help stays instant.
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s %(levelname)-8s %(name)s: %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
)
|
||||
|
||||
from jobsource.pipeline import run_batch # deferred: keeps --help fast before heavy deps
|
||||
run_batch(
|
||||
batch_size=args.batch_size,
|
||||
|
||||
Reference in New Issue
Block a user