microsoft / AzureSMR

AzureSMR is no longer being actively developed. For ongoing support of Azure in R, see: https://github.com/Azure/AzureR
Other
60 stars 43 forks source link

azureRunScriptAction() returns 404 #58

Closed akzaidi closed 7 years ago

akzaidi commented 7 years ago

Example

azureRunScriptAction(sc, 
                     scriptname = "installPackages",
                     scriptURL = "http://mrsactionscripts.blob.core.windows.net/rpackages-v01/InstallRPackages.sh",
                     workerNode = TRUE, edgeNode = TRUE,
                     parameters = "useCRAN stringr")

Returns:

Error in azureRunScriptAction(... 
  Error: Return code 404

Possible Bug Location

It looks like the issue is in the following httr call:

  r <- POST(URL, add_headers(.headers = c(Host = "management.azure.com", 
    Authorization = ATI, `Content-type` = "application/json")), 
    body = bodyI, encode = "json", verbosity)
andrie commented 7 years ago

We now have a function to trap and report on Azure errors:

stopWithAzureError(r)

I will get to HDI functions eventually. Right now I'm gradually refactoring and fixing issues earlier in the code base.

andrie commented 7 years ago

I've started working on refactoring the code for running script actions. This is not yet checked into the dev branch, but here is my hunch.

  1. When I run your code the first time, it completes without any problem.
  2. If I then submit this again, I get an error
Error: azureRunScriptAction()
BadRequest
Scripts with the following names already exist in the persisted
script list: installPackages
Return code: 400

My next action is to expose this error and print a friendly message.

andrie commented 7 years ago

@akzaidi Can you please test again?

akzaidi commented 7 years ago

Does work, thanks ! One weird issue, it prints the following Error: Error: Provide a valid resourceGroup argument, or set using createAzureContext()

Example usage:

> azureRunScriptAction(sc, resourceGroup = "alizaidi", clustername = "azrsparkdev",
                      scriptname = "installlubridate",
                      scriptURL = "http://mrsactionscripts.blob.core.windows.net/rpackages-v01/InstallRPackages.sh",
                      workerNode = TRUE, edgeNode = TRUE,
                      parameters = "useCRAN lubridate")
Accepted
Script action request submitted: 2017-05-31 11:42:45
Key: A - accepted, (.) - in progress, S - succeeded, E - error, F - failed
Error: Provide a valid resourceGroup argument, or set using createAzureContext()
andrie commented 7 years ago

Thanks for the report.

So the error happens when pollStatusScriptAction () passes the request to azureScriptActionHistory() - this requires the resourceGroup.

andrie commented 7 years ago

I've pushed a fix for this to the dev branch.