Skip to content
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

mrc-3167: Add function to cancel reports running on remote #314

Merged
merged 3 commits into from
Apr 26, 2022
Merged

Conversation

r-ash
Copy link
Contributor

@r-ash r-ash commented Apr 22, 2022

This PR will

  • Add function orderly_cancel_remote which will call kill from orderly.server to cancel/kill a report on the remote with its key.

Couple of questions

  • Should exporting kill function become a check in implements_remote? I need to add to sharepoint remote still to explicitly throw an error if trying to call kill there
  • Do we want to do any parsing of the return? This pretty much just returns the output from orderly.server straight to users
  • What do you think of the name? I tried orderly_cancel_remote as close to orderly_run_remote
  • No example for most of the remote functions, is that just the way it is because we don't have a real remote setup for the tests. I could add an example which doesn't get run

vimc/orderlyweb#18 needs to be merged before this will work

@codecov
Copy link

codecov bot commented Apr 22, 2022

Codecov Report

Merging #314 (8a510b6) into master (e4f7f75) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #314   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           41        41           
  Lines         4502      4508    +6     
=========================================
+ Hits          4502      4508    +6     
Impacted Files Coverage Δ
R/remote.R 100.00% <100.00%> (ø)
R/remote_path.R 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d4210e4...8a510b6. Read the comment docs.

@r-ash r-ash requested a review from richfitz April 22, 2022 16:26
Copy link
Member

@richfitz richfitz left a comment

Choose a reason for hiding this comment

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

couple of small comments

@@ -9,6 +9,7 @@ export(orderly_bundle_list)
export(orderly_bundle_pack)
export(orderly_bundle_pack_remote)
export(orderly_bundle_run)
export(orderly_cancel_remote)
Copy link
Member

Choose a reason for hiding this comment

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

should this be orderly_remote_cancel to mirror orderly_remote_status or stay orderly_cancel_remote to mirror orderly_run_remote? Naming things is hard

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have more functions which are orderly_x_remote, though they do tend to be when there is a local equivalent - which there isn't here. I think orderly_cancel_remote feels more natural wording to me so I am happy to stick with that, I don't mind switching it over if you prefer though

orderly_cancel_remote <- function(keys, root = NULL, locate = TRUE,
remote = NULL) {
remote <- get_remote(remote, orderly_config(root, locate))
out <- lapply(keys, remote$kill)
Copy link
Member

Choose a reason for hiding this comment

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

If you don't want to make this part of the "implements remote" thing, fall back here:

if (is.null(remote$kill)) {
  stop(sprintf("your remote (there's a way of getting the type I believe) does not implement kill")
} 

that's probably the tidy thing to do as we don't want to implement this for the path remote

orderly_cancel_remote <- function(keys, root = NULL, locate = TRUE,
remote = NULL) {
remote <- get_remote(remote, orderly_config(root, locate))
out <- lapply(keys, remote$kill)
Copy link
Member

Choose a reason for hiding this comment

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

If you don't want to make this part of the "implements remote" thing, fall back here:

if (is.null(remote$kill)) {
  stop(sprintf("your remote (there's a way of getting the type I believe) does not implement kill")
} 

that's probably the tidy thing to do as we don't want to implement this for the path remote

@r-ash r-ash requested a review from richfitz April 26, 2022 13:50
@@ -9,6 +9,7 @@ export(orderly_bundle_list)
export(orderly_bundle_pack)
export(orderly_bundle_pack_remote)
export(orderly_bundle_run)
export(orderly_cancel_remote)
Copy link
Member

Choose a reason for hiding this comment

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

should this be orderly_remote_cancel to mirror orderly_remote_status or stay orderly_cancel_remote to mirror orderly_run_remote? Naming things is hard

@richfitz richfitz merged commit 447749c into master Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants