From 4a47a5e3e05363826800dde2e623bf6058948d93 Mon Sep 17 00:00:00 2001 From: jonashaase <50448919+jonashaase@users.noreply.github.com> Date: Tue, 3 Dec 2019 16:35:08 +0100 Subject: [PATCH 1/3] No Scidrive in the MPE SciServer --- R/SciDrive.r | 190 --------------------------------------------------- 1 file changed, 190 deletions(-) delete mode 100644 R/SciDrive.r diff --git a/R/SciDrive.r b/R/SciDrive.r deleted file mode 100644 index 4320920..0000000 --- a/R/SciDrive.r +++ /dev/null @@ -1,190 +0,0 @@ -#require( jsonlite) -#require(httr) - -# assumes Config is loaded - -SciDrive.createContainer<-function(path){ - token = Authentication.getToken() - if(!is.null(token) && token != "") - { - - containerBody = paste('', - '', - '',sep="") - - taskName = "" - if(Config.isSciServerComputeEnvironment()){ - taskName = "Compute.SciScript-R.SciDrive.createContainer" - }else{ - taskName = "SciScript-R.SciDrive.createContainer" - } - - url = paste(Config.SciDriveHost,'/vospace-2.0/nodes/',path,"?TaskName=",taskName,sep="") - r = PUT(url, content_type_xml(),body=containerBody,add_headers('X-Auth-Token'=token)) - if(r$status_code < 200 || r$status_code >=300) { - stop(paste("Http Response returned status code ", r$status_code, ":\n", content(r, as="text", encoding="UTF-8"))) - } else { - return(TRUE) - } - }else{ - stop(paste("User token is not defined. First log into SciServer.")) - } -} - - -SciDrive.upload<-function(path, data="", localFilePath=""){ - token = Authentication.getToken() - if(!is.null(token) && token != "") - { - taskName = "" - if(Config.isSciServerComputeEnvironment()){ - taskName = "Compute.SciScript-R.SciDrive.upload" - }else{ - taskName = "SciScript-R.SciDrive.upload" - } - - url = paste(Config.SciDriveHost,'/vospace-2.0/1/files_put/dropbox/',path,"?TaskName=",taskName,sep='') - if(localFilePath != ""){ - r = PUT(url, body=upload_file(localFilePath), add_headers('X-Auth-Token'=token)) - }else{ - r = PUT(url, body=data, add_headers('X-Auth-Token'=token)) - } - if(r$status_code != 200) { - stop(paste("Http Response returned status code ", r$status_code, ":\n", content(r, as="text", encoding="UTF-8"))) - } else { - return (content(r)) - } - }else{ - stop(paste("User token is not defined. First log into SciServer.")) - } -} - -#------------------------------------ -# retrieve public URL for file identified by path -SciDrive.publicUrl<-function(path){ - - token = Authentication.getToken() - if(!is.null(token) && token != "") - { - - taskName = "" - if(Config.isSciServerComputeEnvironment()){ - taskName = "Compute.SciScript-R.SciDrive.publicUrl" - }else{ - taskName = "SciScript-R.SciDrive.publicUrl" - } - - url = paste(Config.SciDriveHost,"/vospace-2.0/1/media/sandbox/", path,"?TaskName=",taskName,sep="") - r = GET(url ,add_headers('X-Auth-Token'=token)) - if(r$status_code == 200){ - return(content(r)$url) - }else{ - stop(paste("Http Response returned status code ", r$status_code, ":\n", content(r, as="text", encoding="UTF-8"))) - } - }else{ - stop(paste("User token is not defined. First log into SciServer.")) - } -} - -SciDrive.directoryList<-function(path){ - - token = Authentication.getToken() - if(!is.null(token) && token != "") - { - - taskName = "" - if(Config.isSciServerComputeEnvironment()){ - taskName = "Compute.SciScript-R.SciDrive.directoryList" - }else{ - taskName = "SciScript-R.SciDrive.directoryList" - } - - url = paste(Config.SciDriveHost,"/vospace-2.0/1/metadata/sandbox/", URLencode(path), "?list=True&path=", URLencode(path),"?TaskName=",taskName, sep="") - r = GET(url ,add_headers('X-Auth-Token'=token)) - if(r$status_code == 200){ - return(content(r)) - }else{ - stop(paste("Http Response returned status code ", r$status_code, ":\n", content(r, as="text", encoding="UTF-8"))) - } - }else{ - stop(paste("User token is not defined. First log into SciServer.")) - } -} - -SciDrive.download<-function(path, format="text", localFilePath=NULL){ - - token = Authentication.getToken() - if(!is.null(token) && token != "") - { - - taskName = "" - if(Config.isSciServerComputeEnvironment()){ - taskName = "Compute.SciScript-R.SciDrive.download" - }else{ - taskName = "SciScript-R.SciDrive.download" - } - - fileUrl = SciDrive.publicUrl(path) - - r = GET(paste(fileUrl,"?TaskName=",taskName,sep="")) - if(r$status_code == 200){ - if(!is.null(localFilePath) && localFilePath != ""){ - bytes = content(r, "raw"); - theFile = file(localFilePath, "wb") - writeBin(bytes, theFile) - close(theFile) - return(TRUE) - }else{ - if(!is.null(format) && format != ""){ - if(format == "text"){ - return(content(r, "text", encoding="UTF-8")) - }else if(format == "raw"){ - return(content(r, "raw")) - }else if(format == "response"){ - return(r) - }else{ - stop(paste("Illegal format parameter specification: ", format)) - } - }else{ - stop(paste("Wrong format parameter value")) - } - } - }else{ - stop(paste("Http Response returned status code ", r$status_code, ":\n", content(r, as="text", encoding="UTF-8"))) - } - }else{ - stop(paste("User token is not defined. First log into SciServer.")) - } -} - -SciDrive.delete<-function(path){ - token = Authentication.getToken() - if(!is.null(token) && token != "") - { - - containerBody = paste('', - '', - '',sep="") - - taskName = "" - if(Config.isSciServerComputeEnvironment()){ - taskName = "Compute.SciScript-R.SciDrive.delete" - }else{ - taskName = "SciScript-R.SciDrive.delete" - } - - url = paste(Config.SciDriveHost,'/vospace-2.0/nodes/',path,"?TaskName=",taskName,sep="") - r = DELETE(url, content_type_xml(),body=containerBody,add_headers('X-Auth-Token'=token)) - if(r$status_code < 200 || r$status_code >=300) { - stop(paste("Http Response returned status code ", r$status_code, ":\n", content(r, as="text", encoding="UTF-8"))) - } else { - return(TRUE) - } - }else{ - stop(paste("User token is not defined. First log into SciServer.")) - } -} \ No newline at end of file From 21a162591784ac3898dd683540824053481a0d10 Mon Sep 17 00:00:00 2001 From: "Haase, Jonas (jhaase)" Date: Wed, 4 Dec 2019 14:15:32 +0100 Subject: [PATCH 2/3] remove scidrive references --- NAMESPACE | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 5eaa520..589b895 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,8 +2,7 @@ export(SkyServer.sqlSearch,SkyServer.getJpegImgCutout,SkyServer.radialSearch,Sky export(CasJobs.getSchemaName,CasJobs.getTables,CasJobs.executeQuery,CasJobs.submitJob,CasJobs.getJobStatus,CasJobs.uploadCSVDataToTable,CasJobs.uploadDataFrameToTable,CasJobs.waitForJob,CasJobs.cancelJob,CasJobs.writeFitsFileFromQuery,CasJobs.uploadCSVFileToTable,CasJobs.taskName) export(Authentication.getKeystoneUserWithToken, Authentication.login, Authentication.getToken, Authentication.setToken, Authentication.token) export(LoginPortal.getKeystoneUserWithToken, LoginPortal.login, LoginPortal.getToken, LoginPortal.setToken) -export(SciDrive.createContainer,SciDrive.upload,SciDrive.publicUrl,SciDrive.download,SciDrive.delete, SciDrive.directoryList) -export(Config.isSciServerComputeEnvironment,Config.CasJobsRESTUri,Config.AuthenticationURL,Config.SciDriveHost,Config.SkyQueryUrl,Config.DataRelease,Config.SkyServerWSurl,Config.Version,Config.KeystoneTokenFilePath,Config.ComputeJobDirectoryFile,Config.RacmApiURL) +export(Config.isSciServerComputeEnvironment,Config.CasJobsRESTUri,Config.AuthenticationURL,Config.SkyQueryUrl,Config.DataRelease,Config.SkyServerWSurl,Config.Version,Config.KeystoneTokenFilePath,Config.ComputeJobDirectoryFile,Config.RacmApiURL) export(SkyQuery.getJobStatus,SkyQuery.cancelJob,SkyQuery.listQueues,SkyQuery.getQueueInfo,SkyQuery.submitJob,SkyQuery.waitForJob,SkyQuery.listJobs,SkyQuery.listAllDatasets,SkyQuery.getDatasetInfo,SkyQuery.listDatasetTables,SkyQuery.getTableInfo,SkyQuery.listTableColumns,SkyQuery.getTable,SkyQuery.dropTable,SkyQuery.uploadTable) export(Files.getFileServices,Files.getFileServicesNames,Files.getFileServiceFromName,Files.__getFileServiceAPIUrl,Files.getRootVolumesInfo,Files.getDataVolumesInfo,Files.getUserVolumesInfo,Files.splitPath,Files.createUserVolume,Files.deleteUserVolume,Files.createDir,Files.delete,Files.upload,Files.download,Files.dirList,Files.move,Files.shareUserVolume) export(Jobs.getDockerComputeDomains,Jobs.getDockerComputeDomainsNames,Jobs.getDockerComputeDomainFromName,Jobs.getRDBComputeDomains,Jobs.getRDBComputeDomainsNames,Jobs.getRDBComputeDomainFromName,Jobs.getJobsList,Jobs.getJobDescription,Jobs.getJobStatus,Jobs.submitNotebookJob,Jobs.submitShellCommandJob,Jobs.submitRDBQueryJob,Jobs.cancelJob,Jobs.waitForJob) From 6a8cdb6780308a7feadfb132791d54dd879fd698 Mon Sep 17 00:00:00 2001 From: "Haase, Jonas (jhaase)" Date: Mon, 5 Oct 2020 14:34:53 +0200 Subject: [PATCH 3/3] updated URLs --- R/Config.r | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/Config.r b/R/Config.r index dac87c1..4dc32d1 100644 --- a/R/Config.r +++ b/R/Config.r @@ -2,9 +2,9 @@ #Although these parameters must be set/defined by the admin or user before the installation of the library, they can also be accessed and changed on-the-fly while on the R session.\n #Config.CasJobsRESTUri: defines the base URL of the CasJobs web API (string). -Config.CasJobsRESTUri = "https://skyserver.sdss.org/CasJobs/RestApi" +Config.CasJobsRESTUri = "https://sciserver.mpe.mpg.de/CasJobs/RestApi" #Config.AuthenticationURL: defines the base URL of the CasJobs web service API -Config.AuthenticationURL = "https://apps.sciserver.org/login-portal/keystone/v3/tokens" +Config.AuthenticationURL = "https://https://twitter.com/standupmaths/status/1313055411285774336/login-portal/keystone/v3/tokens" #Config.SciDriveHost: defines the base URL of the SciDrive web service API Config.SciDriveHost = 'https://www.scidrive.org' #Config.SkyQueryUrl**: defines the base URL of the SkyQuery web service API @@ -12,7 +12,7 @@ Config.SkyQueryUrl = 'https://voservices.net/skyquery/Api/V1' #Config.SkyServerWSurl: defines the base URL of the SkyServer web service API Config.SkyServerWSurl = 'https://skyserver.sdss.org' #Config.DataRelease: defines the SDSS data release, to be used to build the full SkyServer API url along with Config.SkyServerWSurl -Config.DataRelease = 'DR15' # SDSS data release. E.g., DR13 +Config.DataRelease = 'DR16' # SDSS data release. E.g., DR13 #Config.KeystoneTokenPath: defines the local path (string) to the file containing the user's authentication token in the SciServer-Compute environment Config.KeystoneTokenFilePath = "/home/idies/keystone.token" #this path to the file containing the user's keystone token is hardcoded in the sciserver-compute environment #Config.version: defines the SciServer release tag, to which this package belongs @@ -20,7 +20,7 @@ Config.Version = "sciserver-v2.0.13" #sciserver release version #Config.ComputeJobDirectoryFile: defines the path to the file in the "Docker job container" that shows the directory path where the asynchronous compute job is being executed. Config.ComputeJobDirectoryFile = "/home/idies/jobs.path" #Config.RacmApiURL: defines the base URL of the multiple APIs in RACM -Config.RacmApiURL = 'https://apps.sciserver.org/racm'; +Config.RacmApiURL = 'https://sciserver.mpe.mpg.de/racm'; .onLoad <- function(libname, pkgname) { readSciServerConfig <- function(filename) {