-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update Pyinstaller entry point to Java call
- Loading branch information
Showing
1 changed file
with
17 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |