protected override void BeginProcessing() { ProgressRecord pr = new ProgressRecord(1, "Create Custom Module", string.Format("Upload custom module ZIP file \"{0}\" into Azure ML Studio", CustomModuleZipFileName)); pr.PercentComplete = 1; pr.CurrentOperation = "Uploading custom module ZIP file..."; WriteProgress(pr); string uploadedResourceMetadata = Sdk.UploadResource(GetWorkspaceSetting(), "Zip"); JavaScriptSerializer jss = new JavaScriptSerializer(); dynamic m = jss.Deserialize <object>(uploadedResourceMetadata); string uploadId = m["Id"]; Task <string> task = Sdk.UploadResourceInChunksAsnyc(GetWorkspaceSetting(), 1, 0, uploadId, CustomModuleZipFileName, "Zip"); while (!task.IsCompleted) { if (pr.PercentComplete < 100) { pr.PercentComplete++; } else { pr.PercentComplete = 1; } Thread.Sleep(500); WriteProgress(pr); } string uploadMetadata = task.Result; string activityId = Sdk.BeginParseCustomModuleJob(GetWorkspaceSetting(), uploadMetadata); pr.CurrentOperation = "Creating custom module..."; WriteProgress(pr); dynamic statusObj = jss.Deserialize <object>(Sdk.GetCustomModuleBuildJobStatus(GetWorkspaceSetting(), activityId)); string jobStatus = statusObj[0]; while (jobStatus == "Pending") { if (pr.PercentComplete < 100) { pr.PercentComplete++; } else { pr.PercentComplete = 1; } statusObj = jss.Deserialize <object>(Sdk.GetCustomModuleBuildJobStatus(GetWorkspaceSetting(), activityId)); jobStatus = statusObj[0].ToString(); Thread.Sleep(500); WriteProgress(pr); } pr.PercentComplete = 100; WriteProgress(pr); if (jobStatus == "Finished") { string moduleId = statusObj[1]; WriteObject(moduleId); } else { throw new System.Exception("Custom module upload failed: " + statusObj[1]); } }