-
Notifications
You must be signed in to change notification settings - Fork 2
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
Julia build in container #45
Changes from 66 commits
219fafc
66b816c
b6b11c2
f35aa64
c316020
44acad7
974473c
a59913b
dd6a02d
93044c1
9d85834
f036ccd
026560a
79d675a
717ef03
d92e28d
b225460
8e30f68
f0b65e6
9ed5fee
4819e40
3139a54
d96ba54
719146c
8c8510d
887f494
c50b1d6
32b3fa0
70571a0
388cb8c
a39785b
0399586
7b6edc1
6b000e6
c016b3a
0bbd8af
ef45ff3
f003ecc
76a9b67
74e1a16
d590425
267e6ff
c1b43d3
a0ba3c8
6a61f12
3d96134
491f3ac
d040a67
cf30c5c
72c9896
ce08096
36f7972
2698fe8
4db6b29
a262133
7d0b467
b60aae4
86cba59
1aca8b9
82e3802
9b48017
c5b722e
9e45a97
51ed16b
a8aa62b
4e156a3
7663c42
a6fffad
9a5e6e9
0b5944e
b4c124b
2596540
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -13,3 +13,13 @@ LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36" | |||||||
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" | ||||||||
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0" | ||||||||
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76" | ||||||||
|
||||||||
[compat] | ||||||||
ArgParse = "1.1.4" | ||||||||
Folds = "0.2.8" | ||||||||
HDF5 = "0.16.15" | ||||||||
IceFloeTracker = "0.2.1" | ||||||||
LoggingExtras = "1.0.1" | ||||||||
PyCall = "1.96.1" | ||||||||
Pkg = "1.9.0" | ||||||||
TOML = "1.0.3" | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,25 +22,22 @@ Cylc is used to encode the entire pipeline from start to finish and relies on th | |
* this will start a compute session for 1 day with 32 GB memory and 20 cores | ||
* see [here](https://docs.ccv.brown.edu/oscar/submitting-jobs/interact) for more options | ||
|
||
3. Load the Julia module | ||
- [ ] `module load julia/1.9.0` | ||
|
||
4. Build a virtual environment and install Cylc | ||
3. Build a virtual environment and install Cylc | ||
- [ ] `cd <your-project-path>/ice-floe-tracker-pipeline` | ||
- [ ] `conda env create -f ./config/ift-env.yaml` | ||
- [ ] `conda activate ift-env` | ||
|
||
5. Register an account with [space-track.org](https://www.space-track.org/) for SOIT | ||
4. Register an account with [space-track.org](https://www.space-track.org/) for SOIT | ||
|
||
6. Export SOIT username/password to environment variable | ||
5. Export SOIT username/password to environment variable | ||
- [ ] From your home directory `nano .bash_profile` | ||
- [ ] add `export HISTCONTROL=ignoreboth` to the bottom of your .bash_profile | ||
* this will ensure that your username/password are not stored in history | ||
* when exporting the following environment variables, there __must__ be a space in front of each command | ||
- [ ] ` export SPACEUSER=<firstname>_<lastname>@brown.edu` | ||
- [ ] ` export SPACEPSWD=<password>` | ||
Comment on lines
+32
to
38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From Josh's talk yesterday, I was thinking maybe secrets could be used for this. Not sure if it's possible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll make an issue for looking into this. That might be a good way to do it. Talking with @broarr, it seemed like this use case was best to not store anything in a file. |
||
|
||
7. Prepare the runtime environment | ||
6. Prepare the runtime environment | ||
|
||
Cylc will use software dependencies inside a Singularity container to fetch images and satellite times from external APIs. | ||
- [ ] It is a good idea to reset the Singularity cache dir as specified [here](https://docs.ccv.brown.edu/oscar/singularity-containers/building-images) | ||
|
@@ -56,10 +53,7 @@ Cylc is used to encode the entire pipeline from start to finish and relies on th | |
- maxfloearea | ||
- project_dir | ||
**Note:** bounding box format = top_left_x top_left_y bottom_right_x bottom_right_y (x = lat(wgs84) or easting(epsg3413), y = lon(wgs84) or northing(epsg3413)) | ||
|
||
- [ ] run `singularity build fetchdata.simg docker://brownccv/icefloetracker-fetchdata:main` | ||
* This will pull the image containing all the depencies and make them accessible to Cylc | ||
- [ ] then, build the workflow, run it, and open the terminal-based user interface (TUI) to monitor the progress of each task. | ||
- [ ] then, build the workflow, run it, and open the Terminal-based User Interface (TUI) to monitor the progress of each task. | ||
![TUI example](./tui-example.png) | ||
|
||
``` | ||
|
@@ -83,9 +77,9 @@ Cylc is used to encode the entire pipeline from start to finish and relies on th | |
|
||
### Running the Cylc pipeline locally | ||
|
||
When running locally, make sure you have at least Julia 1.9.0 installed with the correct architecture for your local machine. (https://julialang.org/downloads/) | ||
To use the Cylc pipeline locally, also make sure Docker Desktop client is running in the background. (https://www.docker.com/products/docker-desktop/) | ||
|
||
#### Prerequisites | ||
__Julia:__ When running locally, make sure you have at least Julia 1.9.0 installed with the correct architecture for your local machine. (https://julialang.org/downloads/) | ||
__Docker Desktop:__ Also make sure Docker Desktop client is running in the background to use the Cylc pipeline locally. (https://www.docker.com/products/docker-desktop/) | ||
cpaniaguam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
1. Build a virtual environment and install Cylc | ||
- [ ] `cd <your-project-path>/ice-floe-tracker-pipeline` | ||
|
@@ -123,7 +117,7 @@ To use the Cylc pipeline locally, also make sure Docker Desktop client is runnin | |
- [ ] `cylc play <workflow-name>` | ||
- [ ] `cylc tui <workflow-name>` | ||
|
||
The Terminal-based user interface provides a simple way to watch the status of each task called in the `flow.cylc` workflow. Use arrow keys to investigate each task (see more [here](https://cylc.github.io/cylc-doc/latest/html/7-to-8/major-changes/ui.html#cylc-tui). | ||
The Terminal-based User Interface provides a simple way to watch the status of each task called in the `flow.cylc` workflow. Use arrow keys to investigate each task (see more [here](https://cylc.github.io/cylc-doc/latest/html/7-to-8/major-changes/ui.html#cylc-tui). | ||
![TUI](tui-example.png)). | ||
|
||
If you need to change parameters and re-run a workflow, first do: | ||
|
@@ -151,10 +145,10 @@ Open a Julia REPL and build the package | |
Enter Pkg mode and precompile | ||
- [ ] `]` | ||
- [ ] `activate .` | ||
- [ ] `precompile` | ||
- [ ] `build` | ||
|
||
Use the backspace to go back to the Julia REPL and start running Julia code! | ||
|
||
__Note__ Use the help for wrapper scripts to learn about available options in each wrapper function | ||
For example, from a bash prompt: | ||
`julia --project=. ice-floe-tracker-pipeline/workflow/scripts/ice-floe-tracker.jl extractfeatures --help` | ||
`julia --project=. ./workflow/scripts/ice-floe-tracker.jl extractfeatures --help` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
initial cycle point = 1 | ||
[[graph]] | ||
R1 = """ | ||
mkpaths => fetchdata => soit & landmask => preprocess => extractfeatures => tracking & exportH5 | ||
mkpaths & pullfetchimage & pulljuliaimage => fetchdata & soit => landmask => preprocess => extractfeatures => tracking & exportH5 | ||
""" | ||
[runtime] | ||
[[root]] | ||
|
@@ -22,6 +22,7 @@ | |
project_dir = "~/ice-floe-tracker-pipeline" | ||
|
||
# Recommend using these default paths for output | ||
julia_exec = "/usr/local/julia/bin/julia" | ||
results_dir = $project_dir/"results" | ||
fetchdata_dir = $project_dir/"resources" | ||
truecolor_dir = $fetchdata_dir/"truecolor" | ||
|
@@ -30,13 +31,19 @@ | |
preprocess_dir = $results_dir/"preprocess" | ||
soit_dir = $results_dir/"soit" | ||
tracker_dir = $results_dir/"tracker" | ||
h5_dir = $preprocess_dir/"hdf5-files" | ||
|
||
[[mkpaths]] | ||
script = """ | ||
mkdir -p $soit_dir | ||
mkdir -p $landmask_dir | ||
mkdir -p $preprocess_dir | ||
mkdir -p $tracker_dir | ||
mkdir -p $h5_dir | ||
""" | ||
[[pullfetchimage]] | ||
script = """ | ||
apptainer build --force $project_dir/fetchdata.simg docker://brownccv/icefloetracker-fetchdata:main | ||
""" | ||
[[fetchdata]] | ||
script = """ | ||
|
@@ -46,23 +53,27 @@ | |
script = """ | ||
singularity exec --bind $soit_dir:/tmp $project_dir/fetchdata.simg python3 /usr/local/bin/pass_time_cylc.py --startdate $startdate --enddate $enddate --csvoutpath /tmp --centroid_x $centroid_x --centroid_y $centroid_y --SPACEUSER $SPACEUSER --SPACEPSWD $SPACEPSWD | ||
""" | ||
[[pulljuliaimage]] | ||
script = """ | ||
apptainer build --force $project_dir/icefloetracker-julia.simg docker://brownccv/icefloetracker-julia:pr-45 | ||
""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After merging, I'll have to start a new PR and change the image tag to |
||
[[landmask]] | ||
script = """ | ||
singularity exec $project_dir/icefloetracker-julia.simg julia --project="/opt/ice-floe-tracker-pipeline" -t auto $project_dir/workflow/scripts/ice-floe-tracker.jl landmask $fetchdata_dir $landmask_dir | ||
singularity exec --bind $landmask_dir:/tmp $project_dir/icefloetracker-julia.simg $julia_exec -t auto /usr/local/bin/ice-floe-tracker.jl landmask $fetchdata_dir /tmp | ||
""" | ||
[[preprocess]] | ||
script = """ | ||
julia -t auto $project_dir/workflow/scripts/ice-floe-tracker.jl preprocess -t $fetchdata_dir/truecolor -r $fetchdata_dir/reflectance -l $landmask_dir -p $soit_dir -o $preprocess_dir | ||
singularity exec --bind $preprocess_dir:/tmp $project_dir/icefloetracker-julia.simg $julia_exec -t auto /usr/local/bin/ice-floe-tracker.jl preprocess -t $fetchdata_dir/truecolor -r $fetchdata_dir/reflectance -l $landmask_dir -p $soit_dir -o /tmp | ||
""" | ||
[[extractfeatures]] | ||
script = """ | ||
julia -t auto $project_dir/workflow/scripts/ice-floe-tracker.jl extractfeatures -i $preprocess_dir -o $preprocess_dir --minarea $minfloearea --maxarea $maxfloearea | ||
singularity exec --bind $preprocess_dir:/tmp $project_dir/icefloetracker-julia.simg $julia_exec -t auto /usr/local/bin/ice-floe-tracker.jl extractfeatures -i $preprocess_dir -o /tmp --minarea $minfloearea --maxarea $maxfloearea | ||
""" | ||
[[tracking]] | ||
script = """ | ||
julia -t auto $project_dir/workflow/scripts/ice-floe-tracker.jl track --imgs $preprocess_dir --props $preprocess_dir --deltat $preprocess_dir --output $tracker_dir | ||
singularity exec --bind $tracker_dir:/tmp $project_dir/icefloetracker-julia.simg $julia_exec -t auto /usr/local/bin/ice-floe-tracker.jl track --imgs $preprocess_dir --props $preprocess_dir --deltat $preprocess_dir --output /tmp | ||
""" | ||
[[exportH5]] | ||
script = """ | ||
julia -t auto $project_dir/workflow/scripts/ice-floe-tracker.jl makeh5files --pathtosampleimg $fetchdata_dir/truecolor/$(ls $fetchdata_dir/truecolor | head -1) --resdir $preprocess_dir | ||
singularity exec --bind $preprocess_dir:/tmp $project_dir/icefloetracker-julia.simg $julia_exec -t auto /usr/local/bin/ice-floe-tracker.jl makeh5files --pathtosampleimg $fetchdata_dir/truecolor/$(ls $fetchdata_dir/truecolor | head -1) --resdir /tmp | ||
""" | ||
tdivoll marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ channels: | |
- conda-forge | ||
|
||
dependencies: | ||
- cylc-flow=8.2 | ||
- cylc-flow=8.3 |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why delete this file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, I think it just got inadvertently deleted when I was testing (wiping the downloaded resources). |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,11 +79,11 @@ function main(args) | |
# delete log option from command_args so it doesn't get passed to command_func | ||
delete!(command_args, :log) | ||
|
||
logger = setuplogger(logoption, command) | ||
# logger = setuplogger(logoption, command) | ||
|
||
with_logger(logger) do | ||
@time command_func(; command_args...) | ||
end | ||
# with_logger(logger) do | ||
@time command_func(; command_args...) | ||
# end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why comment out the logger? If it's not needed, some deps (LoggingExtras) could also be dropped. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it was the issue with the logger trying to write in the read-only container. I can retest it and see if it will work now that we've updated some other code. It's possible that we have the right bindings now and it might work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was able to add a binding so that it will write the logs to |
||
return nothing | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really required? I see that the command used to run the
ice-floe-tracker.jl
script includes 'julia' which is probably required to pass the-t auto
flag to enable multithreading.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it has to do with the permissions in a singularity container. Things work for container permissions when we copy to
/usr/local/bin
. I was running into issues with running it directly from the repo.