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

wf_request() doesn't expose the url anymore #95

Closed
khufkens opened this issue Jul 26, 2022 · 5 comments
Closed

wf_request() doesn't expose the url anymore #95

khufkens opened this issue Jul 26, 2022 · 5 comments

Comments

@khufkens
Copy link
Member

khufkens commented Jul 26, 2022

@eliocamp by default the wf_request() doesn't expose the url anymore, the task is not submitted.

in wf_request() this

  if (transfer) {
    request$transfer(time_out = time_out)
    if (request$is_success()) {
      return(request$get_file())
    }
    message("Transfer was not successfull.")
  }

  return(request)

should be rewritten along these lines to be able to just submit a job and query on a later date (or through the web interface)

   # submit request
   request$transfer(time_out = time_out) 

    if (request$is_success() & transfer) {
      return(request$get_file())
    } else {
     message("Transfer was not successfull - please check your request later at:")
     message(request$url)
    }

  }
  return(request)

Would this make sense? Don't have time to figure out the R6 setup, but I think it does not break anything.

New branch with fix here:
https://github.com/bluegreen-labs/ecmwfr/tree/expose_url

@khufkens
Copy link
Member Author

Just to clarify, what I want to put back in as it is missing now is to just submit a request and return the API endpoint and that's it. With this you can collect data on a later point using wf_transfer() or on the data request pages (online).

@eliocamp
Copy link
Collaborator

eliocamp commented Jul 26, 2022

I think that would break request_batch, since transfer() locks up the R session waiting for the request to finish, which is what transfer = FALSE should prevent.

How about this?

  # Submit the request
  request$submit()
  
  # Only wait for request to finish if transfer == TRUE
  if (transfer) {
    request$transfer(time_out = time_out)
    if (request$is_success()) {
      return(request$get_file())
    }
     message("Transfer was not successfull - please check your request later at:")
     message(request$url)
  }

  return(request)

(I'm not on my PC so I didn't test it)

@khufkens
Copy link
Member Author

khufkens commented Jul 27, 2022

This works, but it seems the url by default is private and not obviously returned in the print statement.

This can be accessed via:

 request$.__enclos_env__$private$url

But this isn't really intuitive. Having a request$get_url() would be helpful and basically cover this. Will do some digging later as I'm not familiar with the R6 classes etc. (have a rather full plate)

@eliocamp
Copy link
Collaborator

Yes, you're right. I added a get_url() method.

@khufkens
Copy link
Member Author

Thanks merged.

Still have to address the webapi issue on mac, but I'll have to dig into this some more. Closing this with:

#96

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

No branches or pull requests

2 participants