Beispiel #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);
 }
Beispiel #2
0
 public void SaveExperiment(WorkspaceSetting setting, Experiment exp, string rawJson)
 {
     SubmitExperiment(setting, exp, rawJson, string.Empty, false, false);
 }
Beispiel #3
0
 public void SaveExperimentAs(WorkspaceSetting setting, Experiment exp, string rawJson, string newName)
 {
     SubmitExperiment(setting, exp, rawJson, newName, true, false);
 }
Beispiel #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;
 }