コード例 #1
0
        public static ProjectExecutionOptions migrate(PoolCreationOptions poolOptions)
        {
            ProjectExecutionOptions options = null;

            if (poolOptions != null)
            {

                options = new ProjectExecutionOptions();

                /*
                 * PoolCreationOptions to ProjectExecutionOptions.
                 */

                options.rinputs = poolOptions.rinputs;

                if (poolOptions.preloadWorkspace != null)
                {

                    options.preloadWorkspace = new ProjectPreloadOptions();
                    options.preloadWorkspace.filename = poolOptions.preloadWorkspace.filename;
                    options.preloadWorkspace.directory = poolOptions.preloadWorkspace.directory;
                    options.preloadWorkspace.author =  poolOptions.preloadWorkspace.author;
                    options.preloadWorkspace.version =  poolOptions.preloadWorkspace.version;
                }

                if (poolOptions.preloadDirectory != null)
                {

                    options.preloadDirectory = new ProjectPreloadOptions();
                    options.preloadDirectory.filename = poolOptions.preloadDirectory.filename;
                    options.preloadDirectory.directory =  poolOptions.preloadDirectory.directory;
                    options.preloadDirectory.author =  poolOptions.preloadDirectory.author;
                    options.preloadDirectory.version = poolOptions.preloadDirectory.version;
                }

                options.preloadByDirectory = poolOptions.preloadByDirectory;
            }

            return options;
        }
コード例 #2
0
        /// <summary>
        /// Execute a single repository-managed script or a chain of repository-managed scripts
        /// on the current project.
        ///
        /// To execute a chain of repository-managed scripts on this call provide a comma-separated
        /// list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
        /// Chained execution executes each of the scripts identified on the call in a sequential
        /// fashion on the R session, with execution occuring in the order specified on the parameter list.
        ///
        /// Deprecated. As of release 7.1, use executeScript method that supports scriptDirectory parameter. This deprecated call assumes each script is found in the root directory.
        ///
        /// </summary>
        /// <param name="scriptName">name of valid R Script</param>
        /// <param name="scriptAuthor">author of the R Script</param>
        /// <param name="scriptVersion">version of the R Script to execute</param>
        /// <param name="options">Options for this execution</param>
        /// <returns>RProjectExecution object</returns>
        /// <remarks></remarks>
        public RProjectExecution executeScript(String scriptName, String scriptAuthor, String scriptVersion, ProjectExecutionOptions options)
        {
            RProjectExecution returnValue = RProjectExecuteImpl.executeScript(m_projectDetails, scriptName, "root", scriptAuthor, scriptVersion, null, options, m_client, Constants.RPROJECTEXECUTESCRIPT);

            return returnValue;
        }
コード例 #3
0
        /// <summary>
        /// Execute a single script found on a URL/path or a chain of scripts found on a set of URLs/paths
        /// on the current project.
        ///
        /// To execute a chain of repository-managed scripts on this call provide a comma-separated
        /// list of values on the externalSource parameter.
        /// Chained execution executes each of the scripts identified on the call in a sequential
        /// fashion on the R session, with execution occuring in the order specified on the parameter list.
        ///
        /// POWER_USER privileges are required for this call.
        /// </summary>
        /// <param name="externalSource">RScript represented as a URL or DeployR file path</param>
        /// <param name="options">Options for this execution</param>
        /// <returns>RProjectExecution object</returns>
        /// <remarks></remarks>
        public RProjectExecution executeExternal(String externalSource, ProjectExecutionOptions options)
        {
            RProjectExecution returnValue = RProjectExecuteImpl.executeScript(m_projectDetails, null, null, null, null, externalSource, options, m_client, Constants.RPROJECTEXECUTESCRIPT);

            return returnValue;
        }
コード例 #4
0
        /// <summary>
        /// Execute R code on a project
        /// </summary>
        /// <param name="code">R code to be executed</param>
        /// <param name="options">Options for this execution</param>
        /// <returns>RProjectExecution object</returns>
        /// <remarks></remarks>
        public RProjectExecution executeCode(String code, ProjectExecutionOptions options)
        {
            RProjectExecution returnValue = RProjectExecuteImpl.executeCode(m_projectDetails, code, options, m_client, Constants.RPROJECTEXECUTECODE);

            return returnValue;
        }
コード例 #5
0
        public static ProjectExecutionOptions translate(
                                        PooledTaskOptions taskOptions)
        {
            ProjectExecutionOptions options = null;

            if (taskOptions != null)
            {

                options = new ProjectExecutionOptions();

                /*
                 * PooledTaskOptions to ProjectExecutionOptions.
                 */

                options.rinputs = taskOptions.rinputs;
                options.csvrinputs = taskOptions.csvrinputs;

                if (taskOptions.preloadWorkspace != null)
                {

                    options.preloadWorkspace = new ProjectPreloadOptions();
                    options.preloadWorkspace.filename = taskOptions.preloadWorkspace.filename;
                    options.preloadWorkspace.directory = taskOptions.preloadWorkspace.directory;
                    options.preloadWorkspace.author = taskOptions.preloadWorkspace.author;
                    options.preloadWorkspace.version = taskOptions.preloadWorkspace.version;
                }

                if (taskOptions.preloadDirectory != null)
                {

                    options.preloadDirectory = new ProjectPreloadOptions();
                    options.preloadDirectory.filename = taskOptions.preloadDirectory.filename;
                    options.preloadDirectory.directory = taskOptions.preloadDirectory.directory;
                    options.preloadDirectory.author = taskOptions.preloadDirectory.author;
                    options.preloadDirectory.version = taskOptions.preloadDirectory.version;
                }

                options.preloadByDirectory = taskOptions.preloadByDirectory;

                options.graphicsDevice = taskOptions.graphicsDevice;
                options.graphicsWidth = taskOptions.graphicsWidth;
                options.graphicsHeight = taskOptions.graphicsHeight;
                options.echooff = taskOptions.echooff;
                options.consoleoff = taskOptions.consoleoff;
                options.routputs = taskOptions.routputs;
                options.encodeDataFramePrimitiveAsVector = taskOptions.encodeDataFramePrimitiveAsVector;
                options.nan = taskOptions.nan;
                options.infinity = taskOptions.infinity;

                if (taskOptions.storageOptions != null)
                {

                    options.storageOptions = new ProjectStorageOptions();
                    options.storageOptions.directory = taskOptions.storageOptions.directory;
                    options.storageOptions.files = taskOptions.storageOptions.files;
                    options.storageOptions.newVersion = taskOptions.storageOptions.newVersion;
                    options.storageOptions.objects = taskOptions.storageOptions.objects;
                    options.storageOptions.published = taskOptions.storageOptions.published;
                    options.storageOptions.workspace = taskOptions.storageOptions.workspace;
                }
            }

            return options;
        }
コード例 #6
0
        public static RProjectExecution executeCode(RProjectDetails details, String code, ProjectExecutionOptions options, RClient client, String uri)
        {
            StringBuilder data = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            data.Append("&code=" + HttpUtility.UrlEncode(code));

            if (!(options == null))
            {

                if (!(options.rinputs == null))
                {
                    if (options.rinputs.Count > 0)
                    {
                        data.Append("&inputs=");
                        String sJSON = JSONSerialize.createJSONfromRData(options.rinputs);
                        data.Append(HttpUtility.UrlEncode(sJSON));
                        if (HTTPUtilities.DEBUGMODE == true)
                        {
                            Console.Write(sJSON);
                        }
                    }
                }

                if (!(options.preloadDirectory == null))
                {
                    data.Append("&preloadfilename=" + HttpUtility.UrlEncode(options.preloadDirectory.filename));
                    data.Append("&preloadfiledirectory=" + HttpUtility.UrlEncode(options.preloadDirectory.directory));
                    data.Append("&preloadfileauthor=" + HttpUtility.UrlEncode(options.preloadDirectory.author));
                    data.Append("&preloadfileversion=" + HttpUtility.UrlEncode(options.preloadDirectory.version));
                }

                if (!(options.preloadWorkspace == null))
                {
                    data.Append("&preloadobjectname=" + HttpUtility.UrlEncode(options.preloadWorkspace.filename));
                    data.Append("&preloadobjectdirectory=" + HttpUtility.UrlEncode(options.preloadWorkspace.directory));
                    data.Append("&preloadobjectauthor=" + HttpUtility.UrlEncode(options.preloadWorkspace.author));
                    data.Append("&preloadobjectversion=" + HttpUtility.UrlEncode(options.preloadWorkspace.version));
                }

                if (!(options.adoptionOptions == null))
                {
                    data.Append("&adoptworkspace=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptWorkspace));
                    data.Append("&adoptdirectory=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptDirectory));
                    data.Append("&adoptpackages=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptPackages));
                }

                if (!(options.storageOptions == null))
                {
                    data.Append("&storefile=" + HttpUtility.UrlEncode(options.storageOptions.files));
                    data.Append("&storedirectory=" + HttpUtility.UrlEncode(options.storageOptions.directory));
                    data.Append("&storeobject=" + HttpUtility.UrlEncode(options.storageOptions.objects));
                    data.Append("&storeworkspace=" + HttpUtility.UrlEncode(options.storageOptions.workspace));
                    data.Append("&storenewversion=" + options.storageOptions.newVersion.ToString());
                    data.Append("&storepublic=" + options.storageOptions.published.ToString());
                }

                if (!(options.routputs == null))
                {
                    if (options.routputs.Count > 0)
                    {
                        data.Append("&robjects=");
                        foreach (var s in options.routputs)
                        {
                            data.Append(HttpUtility.UrlEncode(s) + ",");
                        }
                        data.Remove(data.Length - 1, 1);
                    }
                }

                data.Append("&echooff=" + options.echooff.ToString());
                data.Append("&consoleoff=" + options.consoleoff.ToString());
                data.Append("&tag=" + HttpUtility.UrlEncode(options.tag));
                data.Append("&graphics=" + HttpUtility.UrlEncode(options.graphicsDevice));
                data.Append("&graphicswidth=" + HttpUtility.UrlEncode(options.graphicsWidth.ToString()));
                data.Append("&graphicsheight=" + HttpUtility.UrlEncode(options.graphicsHeight.ToString()));
                data.Append("&nan=" + HttpUtility.UrlEncode(options.nan));
                data.Append("&infinity=" + HttpUtility.UrlEncode(options.infinity));
                data.Append("&encodeDataFramePrimitiveAsVector=" + options.encodeDataFramePrimitiveAsVector.ToString());
                data.Append("&enableConsoleEvents=" + options.enableConsoleEvents.ToString());
                data.Append("&preloadbydirectory=" + HttpUtility.UrlEncode(options.preloadByDirectory));

            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            RProjectExecution returnValue = new RProjectExecution(jresponse, client);

            return returnValue;
        }
コード例 #7
0
        static public RProjectExecution executeCode(RProjectDetails details, String code, ProjectExecutionOptions options, RClient client, String uri)
        {
            StringBuilder data = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            data.Append("&code=" + HttpUtility.UrlEncode(code));

            if (!(options == null))
            {
                if (!(options.rinputs == null))
                {
                    if (options.rinputs.Count > 0)
                    {
                        data.Append("&inputs=");
                        String sJSON = JSONSerialize.createJSONfromRData(options.rinputs);
                        data.Append(HttpUtility.UrlEncode(sJSON));
                        if (HTTPUtilities.DEBUGMODE == true)
                        {
                            Console.Write(sJSON);
                        }
                    }
                }

                if (!(options.preloadDirectory == null))
                {
                    data.Append("&preloadfilename=" + HttpUtility.UrlEncode(options.preloadDirectory.filename));
                    data.Append("&preloadfiledirectory=" + HttpUtility.UrlEncode(options.preloadDirectory.directory));
                    data.Append("&preloadfileauthor=" + HttpUtility.UrlEncode(options.preloadDirectory.author));
                    data.Append("&preloadfileversion=" + HttpUtility.UrlEncode(options.preloadDirectory.version));
                }

                if (!(options.preloadWorkspace == null))
                {
                    data.Append("&preloadobjectname=" + HttpUtility.UrlEncode(options.preloadWorkspace.filename));
                    data.Append("&preloadobjectdirectory=" + HttpUtility.UrlEncode(options.preloadWorkspace.directory));
                    data.Append("&preloadobjectauthor=" + HttpUtility.UrlEncode(options.preloadWorkspace.author));
                    data.Append("&preloadobjectversion=" + HttpUtility.UrlEncode(options.preloadWorkspace.version));
                }

                if (!(options.adoptionOptions == null))
                {
                    data.Append("&adoptworkspace=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptWorkspace));
                    data.Append("&adoptdirectory=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptDirectory));
                    data.Append("&adoptpackages=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptPackages));
                }

                if (!(options.storageOptions == null))
                {
                    data.Append("&storefile=" + HttpUtility.UrlEncode(options.storageOptions.files));
                    data.Append("&storedirectory=" + HttpUtility.UrlEncode(options.storageOptions.directory));
                    data.Append("&storeobject=" + HttpUtility.UrlEncode(options.storageOptions.objects));
                    data.Append("&storeworkspace=" + HttpUtility.UrlEncode(options.storageOptions.workspace));
                    data.Append("&storenewversion=" + options.storageOptions.newVersion.ToString());
                    data.Append("&storepublic=" + options.storageOptions.published.ToString());
                }

                if (!(options.routputs == null))
                {
                    if (options.routputs.Count > 0)
                    {
                        data.Append("&robjects=");
                        foreach (var s in options.routputs)
                        {
                            data.Append(HttpUtility.UrlEncode(s) + ",");
                        }
                        data.Remove(data.Length - 1, 1);
                    }
                }

                data.Append("&echooff=" + options.echooff.ToString());
                data.Append("&consoleoff=" + options.consoleoff.ToString());
                data.Append("&tag=" + HttpUtility.UrlEncode(options.tag));
                data.Append("&graphics=" + HttpUtility.UrlEncode(options.graphicsDevice));
                data.Append("&graphicswidth=" + HttpUtility.UrlEncode(options.graphicsWidth.ToString()));
                data.Append("&graphicsheight=" + HttpUtility.UrlEncode(options.graphicsHeight.ToString()));
                data.Append("&nan=" + HttpUtility.UrlEncode(options.nan));
                data.Append("&infinity=" + HttpUtility.UrlEncode(options.infinity));
                data.Append("&encodeDataFramePrimitiveAsVector=" + options.encodeDataFramePrimitiveAsVector.ToString());
                data.Append("&enableConsoleEvents=" + options.enableConsoleEvents.ToString());
                data.Append("&preloadbydirectory=" + HttpUtility.UrlEncode(options.preloadByDirectory));
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            RProjectExecution returnValue = new RProjectExecution(jresponse, client);

            return(returnValue);
        }
コード例 #8
0
        /// <summary>
        /// Execute a single script found on a URL/path or a chain of scripts found on a set of URLs/paths
        /// on the current project.
        ///
        /// To execute a chain of repository-managed scripts on this call provide a comma-separated
        /// list of values on the externalSource parameter.
        /// Chained execution executes each of the scripts identified on the call in a sequential
        /// fashion on the R session, with execution occuring in the order specified on the parameter list.
        ///
        /// POWER_USER privileges are required for this call.
        /// </summary>
        /// <param name="externalSource">RScript represented as a URL or DeployR file path</param>
        /// <param name="options">Options for this execution</param>
        /// <returns>RProjectExecution object</returns>
        /// <remarks></remarks>
        public RProjectExecution executeExternal(String externalSource, ProjectExecutionOptions options)
        {
            RProjectExecution returnValue = RProjectExecuteImpl.executeScript(m_projectDetails, null, null, null, null, externalSource, options, m_client, Constants.RPROJECTEXECUTESCRIPT);

            return(returnValue);
        }
コード例 #9
0
        /// <summary>
        /// Execute a single repository-managed script or a chain of repository-managed scripts
        /// on the current project.
        ///
        /// To execute a chain of repository-managed scripts on this call provide a comma-separated
        /// list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
        /// Chained execution executes each of the scripts identified on the call in a sequential
        /// fashion on the R session, with execution occuring in the order specified on the parameter list.
        ///
        /// Deprecated. As of release 7.1, use executeScript method that supports scriptDirectory parameter. This deprecated call assumes each script is found in the root directory.
        ///
        /// </summary>
        /// <param name="scriptName">name of valid R Script</param>
        /// <param name="scriptAuthor">author of the R Script</param>
        /// <param name="scriptVersion">version of the R Script to execute</param>
        /// <param name="options">Options for this execution</param>
        /// <returns>RProjectExecution object</returns>
        /// <remarks></remarks>
        public RProjectExecution executeScript(String scriptName, String scriptAuthor, String scriptVersion, ProjectExecutionOptions options)
        {
            RProjectExecution returnValue = RProjectExecuteImpl.executeScript(m_projectDetails, scriptName, "root", scriptAuthor, scriptVersion, null, options, m_client, Constants.RPROJECTEXECUTESCRIPT);

            return(returnValue);
        }
コード例 #10
0
        /// <summary>
        /// Execute R code on a project
        /// </summary>
        /// <param name="code">R code to be executed</param>
        /// <param name="options">Options for this execution</param>
        /// <returns>RProjectExecution object</returns>
        /// <remarks></remarks>
        public RProjectExecution executeCode(String code, ProjectExecutionOptions options)
        {
            RProjectExecution returnValue = RProjectExecuteImpl.executeCode(m_projectDetails, code, options, m_client, Constants.RPROJECTEXECUTECODE);

            return(returnValue);
        }