Skip to content

Commit

Permalink
chore: update Pyinstaller entry point to Java call
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemDoum committed Nov 20, 2024
1 parent 561488f commit 0b3afbe
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions datashare_spacy_worker/__main__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
import os
import sys
from pathlib import Path
from typing import Annotated

import typer
from icij_worker import WorkerBackend
from icij_worker.backend import start_workers

from datashare_spacy_worker.app import PYTHON_TASK_GROUP

if __name__ == "__main__":
# TODO: it would be nicer to have a dedicated utils to hit the top level CLI
# endpoint from Python main...
# TODO: we should factorize this as much as possible with the DOCKER entrypoint,
# potentially the docker entry point should this main as entry point
n_workers = os.environ.get("N_PROCESSING_WORKERS", 1)
config_path = sys.argv[1]
cli_app = typer.Typer()


@cli_app.command()
def main(
config_path: Annotated[Path, typer.Argument(help="Path to config file")],
n_workers: Annotated[
int, typer.Option("-n", "--n-workers", help="Number of NLP workers")
] = 1,
):
start_workers(
"datashare_spacy_worker.app.app",
n_workers,
config_path,
backend=WorkerBackend.MULTIPROCESSING,
group=PYTHON_TASK_GROUP,
)


if __name__ == "__main__":
cli_app()

0 comments on commit 0b3afbe

Please sign in to comment.