-
Notifications
You must be signed in to change notification settings - Fork 0
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
[GH-1221] import snapshots into a workspace #347
Conversation
…` implementation for REPEATED data types
and an `updated` datetime. Add REST wrappers for getting/deleting entities in a workspace Implement test for importing a snapshot into a workspace. Won't work until the dataset above is rebuild.
e456f28
to
2b8d226
Compare
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.
This looks great! Thanks for adding the import functionalities!! I left some questions, mainly for my own understanding
api/src/wfl/util.clj
Outdated
(throw (TimeoutException. "Max number of attempts exceeded"))) | ||
(log/debugf "Sleeping - attempt #%s" attempt) | ||
(.sleep TimeUnit/MILLISECONDS 100) | ||
(recur (inc attempt))))))) |
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.
could you help explain the use case of this function? it looks like this is more like "check thrice in 0.3 seconds, throw or proceed with thunk" than a regular polling to me. (i guess it's the short sleep time and the small attempt number cap got me?)
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.
Because importing the entity then getting the entity sometimes returns empty. This code tries at most 3 times to call the get. I've just pulled out the thunk.
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.
Because importing the entity then getting the entity sometimes returns empty.
That is weird… So the point of this function is more like repeat more times than wait?
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.
No, the goal is to poll the endpoint until the new entity is visible. It'll call at most 3 times.
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.
Thank you for figuring this out.
api/src/wfl/service/datarepo.clj
Outdated
@@ -74,24 +77,23 @@ | |||
"ingest" | |||
dataset-id | |||
{:format "json" | |||
:load_tag "string" | |||
:load_tag (new-load-tag) | |||
:max_bad_records 0 | |||
:path path | |||
:table table})) |
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.
Odd formatting, but old.
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.
How could it be improved?
(map :name) | ||
set)] | ||
(doseq [[_ name] entities] (is (contains? names name)))) | ||
(finally (firecloud/delete-entities workspace entities)))))))) |
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.
This could (keep :name)
and drop contains?
.
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.
Wouldn't (keep :name)
and (map :name)
both deliver the same thing?
#{"running"})] | ||
(while (running?) (.sleep TimeUnit/SECONDS seconds)) | ||
(result))) | ||
([job-id] |
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.
Clojure q - is a multi-arity function the best / only way to provide default argument(s)? What about the case where you might wish to allow multiple default arguments?
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.
It's certainly one way, not sure if it's the best way. You can simulate named arguments by taking key-value pairs. Here's one way to implement that. There other ways and I'm not sure this is the best:
(let [defaults {:foo 'value1
:bar 'value2
:baz 'value3}]
(defn my-named-args-function
[& options]
(let [inputs (apply assoc defaults options)]
(use inputs))))
;; usage
(my-named-args-function :bar 12 :baz pi)
RR: https://broadinstitute.atlassian.net/browse/GH-1221
In this PR, I'm adding test demonstration code for how to import data from a TDR snapshot into a Terra Workspace. This includes:
The renaming works by viewing the rows of the table as a list of maps, mapping those names onto workspace names, then reconstructing the table.
Added dataset/snapshot querying utilities to the
datarepo
namespace.Bug fixes: