-
Notifications
You must be signed in to change notification settings - Fork 5
make parent_flow as job router #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xiaoyachong
wants to merge
29
commits into
mlexchange:main
Choose a base branch
from
xiaoyachong:xiaoya-new-feature-router
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
5f3ac9e
make parent_flow as job router
xiaoyachong 46658c6
make parent_flow as job router
xiaoyachong a7b4884
separate parent and child workers
xiaoyachong f39f941
Fix parent flow failure propagation
xiaoyachong e825b4f
update job params list
xiaoyachong f2c75ea
address pr comments
xiaoyachong 3e889ad
upgrade prefect version
xiaoyachong 46b5271
add mlflow
xiaoyachong 8683939
change type from process to docker for docker_pool
xiaoyachong 64fceca
update env and readme
xiaoyachong 8d27648
use run_process for docker
xiaoyachong f1d83d8
add conda env for segmentation
xiaoyachong 7f96d71
update env
xiaoyachong e842660
read credentials from env
xiaoyachong 4e47fb0
refactor parent flow
xiaoyachong b944dbb
load credentials in child flow
xiaoyachong 132f171
remove unified child worker
xiaoyachong 9624877
update scripts
xiaoyachong 5633e33
update conda flow
xiaoyachong 1c5ba4f
change docker_pool type back to process
xiaoyachong 6b2a4e3
update config
xiaoyachong f51ff59
fix conda
xiaoyachong 556b15f
clean up
xiaoyachong 50d21c7
update readme
xiaoyachong 2a06c3c
add child status check
xiaoyachong bd0522b
update typer version
xiaoyachong 25a496b
add version for conda env
xiaoyachong 5c00dfb
update volumes
xiaoyachong bb33da0
update conda env
xiaoyachong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -160,4 +160,6 @@ cython_debug/ | |
| #.idea/ | ||
|
|
||
|
|
||
| .vscode/ | ||
| .vscode/ | ||
| .DS_Store | ||
| logs/ | ||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #!/bin/bash | ||
| source .env | ||
|
|
||
| export PREFECT_WORK_DIR=$PREFECT_WORK_DIR | ||
| prefect config set PREFECT_API_URL=$PREFECT_API_URL | ||
|
|
||
| # 1. Create work pools for job type docker | ||
| prefect work-pool create docker_pool --type "process" | ||
| prefect work-pool set-concurrency-limit docker_pool $PREFECT_WORK_POOL_CONCURRENCY | ||
| PREFECT_WORKER_WEBSERVER_PORT=8081 prefect worker start --pool docker_pool --limit $PREFECT_WORKER_LIMIT --with-healthcheck & | ||
|
|
||
| # 2. Create work pools for job type docker | ||
| prefect work-pool create podman_pool --type "process" | ||
| prefect work-pool set-concurrency-limit podman_pool $PREFECT_WORK_POOL_CONCURRENCY | ||
| PREFECT_WORKER_WEBSERVER_PORT=8082 prefect worker start --pool podman_pool --limit $PREFECT_WORKER_LIMIT --with-healthcheck & | ||
|
|
||
| # 3. Create work pools for job type conda | ||
| prefect work-pool create conda_pool --type "process" | ||
| prefect work-pool set-concurrency-limit conda_pool $PREFECT_WORK_POOL_CONCURRENCY | ||
| PREFECT_WORKER_WEBSERVER_PORT=8083 prefect worker start --pool conda_pool --limit $PREFECT_WORKER_LIMIT --with-healthcheck & | ||
|
|
||
| # 4. Create work pools for job type slurm | ||
| prefect work-pool create slurm_pool --type "process" | ||
| prefect work-pool set-concurrency-limit slurm_pool $PREFECT_WORK_POOL_CONCURRENCY | ||
| PREFECT_WORKER_WEBSERVER_PORT=8084 prefect worker start --pool slurm_pool --limit $PREFECT_WORKER_LIMIT --with-healthcheck & | ||
|
|
||
| echo "All workers started" | ||
| wait |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Load environment variables from .env file | ||
| source .env | ||
|
|
||
| echo "Executing Folder: ${PWD}" | ||
| # Initialize conda | ||
| source "$CONDA_PATH/etc/profile.d/conda.sh" | ||
|
|
||
| # Start the worker command in the background, capture its PID, and assign the log file | ||
| ( | ||
| export PREFECT_WORK_DIR=$PREFECT_WORK_DIR | ||
| export PYTHONPATH=$PWD:$PYTHONPATH | ||
| prefect config set PREFECT_API_URL=$PREFECT_API_URL | ||
|
|
||
| # Create log directory if it doesn't exist | ||
| mkdir -p logs | ||
|
|
||
| # 1. Create docker worker pool | ||
| prefect work-pool create docker_pool --type "process" || true | ||
| prefect work-pool set-concurrency-limit docker_pool $PREFECT_WORK_POOL_CONCURRENCY | ||
|
|
||
| # Start the docker worker with logs that include PID | ||
| PREFECT_WORKER_WEBSERVER_PORT=8081 prefect worker start --pool docker_pool --limit $PREFECT_WORKER_LIMIT --with-healthcheck > "process_temp_docker.log" 2>&1 & | ||
| docker_pid=$! | ||
| # Rename the log file to include the actual PID of the worker process | ||
| docker_log="logs/docker_worker_${docker_pid}.log" | ||
| mv "process_temp_docker.log" "$docker_log" | ||
| echo "Started Docker worker with PID: $docker_pid and logging to $docker_log" | ||
|
|
||
| # 2. Create podman worker pool | ||
| prefect work-pool create podman_pool --type "process" || true | ||
| prefect work-pool set-concurrency-limit podman_pool $PREFECT_WORK_POOL_CONCURRENCY | ||
|
|
||
| # Start the podman worker with logs that include PID | ||
| PREFECT_WORKER_WEBSERVER_PORT=8082 prefect worker start --pool podman_pool --limit $PREFECT_WORKER_LIMIT --with-healthcheck > "process_temp_podman.log" 2>&1 & | ||
| podman_pid=$! | ||
| # Rename the log file to include the actual PID of the worker process | ||
| podman_log="logs/podman_worker_${podman_pid}.log" | ||
| mv "process_temp_podman.log" "$podman_log" | ||
| echo "Started Podman worker with PID: $podman_pid and logging to $podman_log" | ||
|
|
||
| # 3. Create conda worker pool | ||
| prefect work-pool create conda_pool --type "process" || true | ||
| prefect work-pool set-concurrency-limit conda_pool $PREFECT_WORK_POOL_CONCURRENCY | ||
|
|
||
| # Start the conda worker with logs that include PID | ||
| PREFECT_WORKER_WEBSERVER_PORT=8083 prefect worker start --pool conda_pool --limit $PREFECT_WORKER_LIMIT --with-healthcheck > "process_temp_conda.log" 2>&1 & | ||
| conda_pid=$! | ||
| # Rename the log file to include the actual PID of the worker process | ||
| conda_log="logs/conda_worker_${conda_pid}.log" | ||
| mv "process_temp_conda.log" "$conda_log" | ||
| echo "Started Conda worker with PID: $conda_pid and logging to $conda_log" | ||
|
|
||
| # 4. Create slurm worker pool | ||
| prefect work-pool create slurm_pool --type "process" || true | ||
| prefect work-pool set-concurrency-limit slurm_pool $PREFECT_WORK_POOL_CONCURRENCY | ||
|
|
||
| # Start the slurm worker with logs that include PID | ||
| PREFECT_WORKER_WEBSERVER_PORT=8084 prefect worker start --pool slurm_pool --limit $PREFECT_WORKER_LIMIT --with-healthcheck > "process_temp_slurm.log" 2>&1 & | ||
| slurm_pid=$! | ||
| # Rename the log file to include the actual PID of the worker process | ||
| slurm_log="logs/slurm_worker_${slurm_pid}.log" | ||
| mv "process_temp_slurm.log" "$slurm_log" | ||
| echo "Started Slurm worker with PID: $slurm_pid and logging to $slurm_log" | ||
|
|
||
| echo "All child workers started in background" | ||
|
|
||
| # Create a pid file with all workers for easy termination later | ||
| echo "$docker_pid $podman_pid $conda_pid $slurm_pid" > logs/child_workers_pids.txt | ||
| echo "PIDs saved to logs/child_workers_pids.txt for future reference" | ||
|
|
||
| # Output summary | ||
| echo "" | ||
| echo "===== Child Workers Summary =====" | ||
| echo "Docker worker: PID $docker_pid, Port 8081, Log: $docker_log" | ||
| echo "Podman worker: PID $podman_pid, Port 8082, Log: $podman_log" | ||
| echo "Conda worker: PID $conda_pid, Port 8083, Log: $conda_log" | ||
| echo "Slurm worker: PID $slurm_pid, Port 8084, Log: $slurm_log" | ||
| echo "==============================" | ||
| echo "" | ||
| echo "To view logs, use: tail -f $docker_log" | ||
| echo "To stop workers, run: kill \$(cat logs/child_workers_pids.txt)" | ||
| ) |
This file contains hidden or 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
taxe10 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.