CovertLab / sisyphus

Eternally execute tasks
0 stars 0 forks source link

"/": upload/download files vs. directories #9

Open 1fish2 opened 5 years ago

1fish2 commented 5 years ago

Currently it's possible to trip up by downloading a GCS "foo/" entry as a file "foo", which then breaks attempts by Sisyphus or by the worker task itself to create files or subdirectories in that "directory." Then one can spend a lot of time debugging.

The Step and the Command together specify each input and output path:

  1. Step foo, Command foo: upload/download a file
  2. Step foo/, Command foo: illegal combination
  3. Step foo, Command foo/: upload/download an entire directory tree
  4. Step foo/, Command foo/: illegal combination

The Workflow builder always constructs the Step path without a trailing /, so those workflows are fine.

In Sisyphus

I don't know how to reproduce today's nasty case with the Sisyphus code:

sisyphus.core=> (cloud/download! storage "sisyphus" "data/jerry/20190817.114027/metadata" "/tmp/metadata")
ERROR: file unavailable to download sisyphus:data/jerry/20190817.114027/metadata
nil
sisyphus.core=> (cloud/download! storage "sisyphus" "data/jerry/20190817.114027/metadata/" "/tmp/metadata")
download data/jerry/20190817.114027/metadata/ data/jerry/20190817.114027/metadata/ to /tmp/metadata
true ; downloaded just the metadata/ directory, as a directory
sisyphus.core=> (cloud/download! storage "sisyphus" "data/jerry/20190817.114027/metadata" "/tmp/metadata/")
ERROR: file unavailable to download sisyphus:data/jerry/20190817.114027/metadata
nil
sisyphus.core=> (cloud/download! storage "sisyphus" "data/jerry/20190817.114027/metadata/" "/tmp/metadata/")
download data/jerry/20190817.114027/metadata/ data/jerry/20190817.114027/metadata/ to /tmp/metadata/
true ; downloaded just the metadata/ directory, as a directory

sisyphus.core=> (cloud/download-tree! storage "sisyphus" "data/jerry/20190817.114027/metadata" "/tmp/metadata")
nil ; downloaded the tree
sisyphus.core=> (cloud/download-tree! storage "sisyphus" "data/jerry/20190817.114027/metadata/" "/tmp/metadata")

Execution error (StringIndexOutOfBoundsException) at java.lang.String/substring (String.java:1931).
String index out of range: -1
sisyphus.core=> (cloud/download-tree! storage "sisyphus" "data/jerry/20190817.114027/metadata" "/tmp/metadata/")
nil ; downloaded the tree
sisyphus.core=> (cloud/download-tree! storage "sisyphus" "data/jerry/20190817.114027/metadata/" "/tmp/metadata/")

Execution error (StringIndexOutOfBoundsException) at java.lang.String/substring (String.java:1931).
String index out of range: -1

Proposals: