Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

snakemake #14

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

snakemake #14

wants to merge 12 commits into from

Conversation

jsadler2
Copy link
Contributor

Adding snakefile to gridmet repo.

For some reason, this isn't working quite right yet.

The *gdf.pickle file isn't being written out. So I sill need to do some debugging.

@jsadler2 jsadler2 marked this pull request as draft May 19, 2022 18:13
@jsadler2 jsadler2 marked this pull request as ready for review June 15, 2022 14:48
Copy link
Collaborator

@msleckman msleckman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made several attempts at running this in hpc and ran into errors as I describe below.

@jzwart could you give this a try as well?

README.md Outdated

You can run the workflow via `sbatch`
```
sbatch -A iidd slurm/launch_snakemake.slum config_nhd.yml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sbatch -A iidd slurm/launch_snakemake.slum config_nhd.yml
sbatch -A iidd slurm/launch_snakemake.slurm config_nhd.yml

```
salloc -N 1 -n 8 -t 10:00:00 -p cpu -A iidd
module load singularity
singularity exec-agg_v0.3.sif /opt/conda/bin/snakemake -j --configfile config_nhd.yml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a typo right?

Suggested change
singularity exec-agg_v0.3.sif /opt/conda/bin/snakemake -j --configfile config_nhd.yml
singularity exec gridmet-agg_v0.3.sif /opt/conda/bin/snakemake -j --configfile config_nhd.yml

Comment on lines +45 to +47
salloc -N 1 -n 8 -t 10:00:00 -p cpu -A iidd
module load singularity
singularity exec-agg_v0.3.sif /opt/conda/bin/snakemake -j --configfile config_nhd.yml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run:

salloc -N 1 -n 8 -t 10:00:00 -p cpu -A iidd
module load singularity
singularity exec gridmet-agg_v0.3.sif /opt/conda/bin/snakemake -j --configfile config_nhd.yml

from the pump/gridmet/drb_gridmet_tools/ (following option A).
I get a Permission error
Permission denied: '/caldera/projects/usgs/water/impd/pump/gridmet/drb_gridmet_tools/.snakemake/log/2022-09-20T203254.660009.snakemake.log'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't write access to all the files / directories (see below) so everyone but Jeff will get this error. We'll have to ask HPC folks to give group permissions in this folder because I'm pretty sure Jeff doesn't have access to USGS HPC anymore

[jzwart@tg-login1 drb_gridmet_tools] ls -la
total 995356
drwxr-sr-x 11 jsadler pump       4096 Jun 17 12:24 .
drwxr-sr-x  3 jsadler pump       4096 Jan 28  2022 ..
drwxr-sr-x  3 jsadler pump       4096 Jun 17 12:22 archive
-rw-r--r--  1 jsadler pump        509 Jun 15 13:43 config_nhd.yml
-rw-r--r--  1 jsadler pump        536 Jun 15 16:04 config_nhm.yml
drwxr-sr-x  4 jsadler pump       4096 Jun 14 11:09 drb-gridmet
-rw-r--r--  1 jsadler pump        536 Apr  8 11:42 environment.yml
drwxr-sr-x  8 jsadler pump       4096 Jun 17 12:24 .git
-rw-r--r--  1 jsadler pump        123 Jan 28  2022 .gitignore
-rw-r--r--  1 jsadler pump       3079 Jun 15 12:34 gridmet_aggregation_PRMS.py
-rwxrwxr-x  1 jsadler pump 1019154432 Jun 15 13:40 gridmet-agg_v0.3.sif
-rw-r--r--  1 jsadler pump       7329 Jun 14 15:51 gridmet_split_script.py
drwxr-sr-x  2 jsadler pump       4096 Apr 21 15:57 .ipynb_checkpoints
drwxr-sr-x  2 jsadler pump       4096 Jun 15 12:34 __pycache__
-rw-r--r--  1 jsadler pump       4081 Jun 15 16:06 README.md
drwxr-sr-x  5 jsadler pump       4096 Jun 15 13:46 scratch
drwxr-sr-x  2 jsadler pump       4096 Jun 17 12:23 slurm
drwxr-sr-x  2 jsadler pump       4096 Jun 17 12:23 slurm_out
-rw-r--r--  1 jsadler pump       6400 Jun 15 16:02 Snakefile
drwxr-sr-x 11 jsadler pump       4096 Jun  9 16:57 .snakemake

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll ask in #tallgrass-help channel

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes sense 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did we get any response on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes (see here), they changed who owns the files and permissions should be updated.

[jzwart@tg-login2 drb_gridmet_tools] ls -la
total 995356
drwxrwsr-x 11 jzwart pump       4096 Jun 17 12:24 .
drwxrwsr-x  3 jzwart pump       4096 Jan 28  2022 ..
drwxrwsr-x  3 jzwart pump       4096 Jun 17 12:22 archive
-rw-rwxr--  1 jzwart pump        509 Jun 15 13:43 config_nhd.yml
-rw-rwxr--  1 jzwart pump        536 Jun 15 16:04 config_nhm.yml
drwxrwsr-x  4 jzwart pump       4096 Jun 14 11:09 drb-gridmet
-rw-rwxr--  1 jzwart pump        536 Apr  8 11:42 environment.yml
drwxrwsr-x  8 jzwart pump       4096 Jun 17 12:24 .git
-rw-rwxr--  1 jzwart pump        123 Jan 28  2022 .gitignore
-rw-rwxr--  1 jzwart pump       3079 Jun 15 12:34 gridmet_aggregation_PRMS.py
-rwxrwxr-x  1 jzwart pump 1019154432 Jun 15 13:40 gridmet-agg_v0.3.sif
-rw-rwxr--  1 jzwart pump       7329 Jun 14 15:51 gridmet_split_script.py
drwxrwsr-x  2 jzwart pump       4096 Apr 21 15:57 .ipynb_checkpoints
drwxrwsr-x  2 jzwart pump       4096 Jun 15 12:34 __pycache__
-rw-rwxr--  1 jzwart pump       4081 Jun 15 16:06 README.md
drwxrwsr-x  5 jzwart pump       4096 Jun 15 13:46 scratch
drwxrwsr-x  2 jzwart pump       4096 Jun 17 12:23 slurm
drwxrwsr-x  2 jzwart pump       4096 Jun 17 12:23 slurm_out
-rw-rwxr--  1 jzwart pump       6400 Jun 15 16:02 Snakefile
drwxrwsr-x 11 jzwart pump       4096 Jun  9 16:57 .snakemake

Comment on lines +53 to +61
git clone [email protected]:USGS-R/drb_gridmet_tools.git
cd drb_gridmet_tools
```
2. Pull down Docker image into a Singularity file
```
singularity pull docker://jsadler2/gridmet-agg:v0.3
```
3. Do Steps 2-4 from Option A.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this in my own user dir in tallgrass (as well as on a different project dir) in impd/pump/ and in both cases got the following error:

ERROR 1: PROJ: proj_create_from_database: Open of /opt/conda/share/proj failed
Building DAG of jobs... 

and botocore.exceptions.NoCredentialsError: Unable to locate credentials

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this refers to the S3 credentials - could you try re-running after setting use_S3: False in the config_XXX.yml ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure in that case I run locally?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that'd help to run locally.

The re-gridding process for the Delaware River Basin has been run on USGS's Tallgrass via Singularity. It has been run for the National Hydrologic Model (NHM) fabric and the National Hydrographic Database (NHD) fabric. It should be able to be run via Docker as well as Singularity, but it has not been tried yet. Instructions for running and modifying the pipeline are below.

_Parallelization in Snakemake_
The Snakemake workflow parallelizes the re-gridding of the 8 Gridmet variables. As long as you provide at least 8 cores, these tasks will run in parallel.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this set up and the Snakefile is clear! I did not get a chance to say this earlier, but thanks for setting this up like this.

README.md Outdated Show resolved Hide resolved
Comment on lines +45 to +47
salloc -N 1 -n 8 -t 10:00:00 -p cpu -A iidd
module load singularity
singularity exec-agg_v0.3.sif /opt/conda/bin/snakemake -j --configfile config_nhd.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't write access to all the files / directories (see below) so everyone but Jeff will get this error. We'll have to ask HPC folks to give group permissions in this folder because I'm pretty sure Jeff doesn't have access to USGS HPC anymore

[jzwart@tg-login1 drb_gridmet_tools] ls -la
total 995356
drwxr-sr-x 11 jsadler pump       4096 Jun 17 12:24 .
drwxr-sr-x  3 jsadler pump       4096 Jan 28  2022 ..
drwxr-sr-x  3 jsadler pump       4096 Jun 17 12:22 archive
-rw-r--r--  1 jsadler pump        509 Jun 15 13:43 config_nhd.yml
-rw-r--r--  1 jsadler pump        536 Jun 15 16:04 config_nhm.yml
drwxr-sr-x  4 jsadler pump       4096 Jun 14 11:09 drb-gridmet
-rw-r--r--  1 jsadler pump        536 Apr  8 11:42 environment.yml
drwxr-sr-x  8 jsadler pump       4096 Jun 17 12:24 .git
-rw-r--r--  1 jsadler pump        123 Jan 28  2022 .gitignore
-rw-r--r--  1 jsadler pump       3079 Jun 15 12:34 gridmet_aggregation_PRMS.py
-rwxrwxr-x  1 jsadler pump 1019154432 Jun 15 13:40 gridmet-agg_v0.3.sif
-rw-r--r--  1 jsadler pump       7329 Jun 14 15:51 gridmet_split_script.py
drwxr-sr-x  2 jsadler pump       4096 Apr 21 15:57 .ipynb_checkpoints
drwxr-sr-x  2 jsadler pump       4096 Jun 15 12:34 __pycache__
-rw-r--r--  1 jsadler pump       4081 Jun 15 16:06 README.md
drwxr-sr-x  5 jsadler pump       4096 Jun 15 13:46 scratch
drwxr-sr-x  2 jsadler pump       4096 Jun 17 12:23 slurm
drwxr-sr-x  2 jsadler pump       4096 Jun 17 12:23 slurm_out
-rw-r--r--  1 jsadler pump       6400 Jun 15 16:02 Snakefile
drwxr-sr-x 11 jsadler pump       4096 Jun  9 16:57 .snakemake

Comment on lines +45 to +47
salloc -N 1 -n 8 -t 10:00:00 -p cpu -A iidd
module load singularity
singularity exec-agg_v0.3.sif /opt/conda/bin/snakemake -j --configfile config_nhd.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll ask in #tallgrass-help channel

Comment on lines +53 to +61
git clone [email protected]:USGS-R/drb_gridmet_tools.git
cd drb_gridmet_tools
```
2. Pull down Docker image into a Singularity file
```
singularity pull docker://jsadler2/gridmet-agg:v0.3
```
3. Do Steps 2-4 from Option A.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this refers to the S3 credentials - could you try re-running after setting use_S3: False in the config_XXX.yml ?

Co-authored-by: Jake Zwart <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants