예제 #1
0
 private void SubmitExperiment(WorkspaceSetting setting, Experiment exp, string rawJson, string newName, bool createNewCopy, bool run)
 {
     ValidateWorkspaceSetting(setting);  
     Util.AuthorizationToken = setting.AuthorizationToken;
     string body = CreateSubmitExperimentRequest(exp, rawJson, run, newName, createNewCopy);
     string queryUrl = StudioApi + string.Format("workspaces/{0}/experiments/{1}", setting.WorkspaceId, createNewCopy ? string.Empty : exp.ExperimentId);
     HttpResult hr = Util.HttpPost(queryUrl, body).Result;
     if (!hr.IsSuccess)
         throw new AmlRestApiException(hr);
 }
예제 #2
0
 public void SaveExperiment(WorkspaceSetting setting, Experiment exp, string rawJson)
 {
     SubmitExperiment(setting, exp, rawJson, string.Empty, false, false);
 }
예제 #3
0
 public void SaveExperimentAs(WorkspaceSetting setting, Experiment exp, string rawJson, string newName)
 {
     SubmitExperiment(setting, exp, rawJson, newName, true, false);
 }
예제 #4
0
 private string CreateSubmitExperimentRequest(Experiment exp, string rawJson, bool runExperiment, string newName, bool createNewCopy)
 {
     string graph = GetExperimentGraphFromJson(rawJson);
     string webService = GetExperimentWebServiceFromJson(rawJson);
     string req = "{" + string.Format("\"Description\":\"{0}\", \"Summary\":\"{1}\", \"IsDraft\":" + (runExperiment ? "false" : "true") +
         ", \"ParentExperimentId\":\"{2}\", \"DisableNodeUpdate\":false, \"Category\":\"user\", \"ExperimentGraph\":{3}, \"WebService\":{4}",
                     string.IsNullOrEmpty(newName)? exp.Description : newName, exp.Summary, createNewCopy ? null : exp.ParentExperimentId, graph, webService) + "}";
     return req;
 }