public void addTaskToCurrentProject(string taskName) { string taskDummyFile = taskName + ".txt"; CloudBlob taskDummyFileBlob = UserStatus.getInstance().userContainer.GetBlobReference(projectName + "/" + projectDummyFile + "/" + taskDummyFile); Task task = new Task(taskName, taskDummyFile, taskDummyFileBlob); this.tasksMap.Add(taskName, task); }
protected void LaunchTask(object sender, System.EventArgs e) { string projectName = "NewProject"; StringBuilder queueMsg; foreach (ListItem item in SelectedFileList.Items) { queueMsg = new StringBuilder(); queueMsg.Append(User.Identity.Name); queueMsg.Append("+" + projectName); queueMsg.Append("+" + TaskNameText.Text); queueMsg.Append("+" + ExeFile.FileName); int[] indices = AvailableFileList.GetSelectedIndices(); queueMsg.Append("+" + indices.Length); queueMsg.Append("+" + item.Value); queueMsg.Append("+" + DatasetList.SelectedValue); queueMsg.Append("+" + item.Text); string msg = queueMsg.ToString(); //Setting Metadata when a project and task are initiated. /*CloudBlob blobRef = blobStorage.GetBlobReference(projectName + "" + TaskNameText.Text); blobRef.Metadata.Add("User", User.Identity.Name + " Blah"); blobRef.Metadata.Add("ProjectName", projectName); blobRef.Metadata.Add("TaskName", TaskNameText.Text); //Could use a for loop if we know number of exes selected by user. blobRef.Metadata.Add("ExeName", ExeFile.FileName); blobRef.Metadata.Add("DatasetFTPURI", DatasetFTP); blobRef.Metadata.Add("Dataset", DatasetList.SelectedValue); blobRef.SetMetadata();*/ Task newTask = new Task(TaskNameText.Text); CloudBlob taskBlob = blobStorage.GetBlobReference(projectName + "/" + TaskNameText.Text); newTask.taskDummyFileBlob = taskBlob; newTask.addTaskMetadata("author", "sudarshan"); newTask.addTaskMetadata("timestamp", DateTime.Now.ToString("yyyy.MM.dd hh:mm:ss")); newTask.commitTaskMetadata(); Response.Write("ENQUEUED => " + msg + "\n"+"Metadata for User task blob : "+newTask.getTaskMetadataFromBlob()["timestamp"]); GetProgramRunnerQueue().AddMessage(new CloudQueueMessage(System.Text.Encoding.UTF8.GetBytes(queueMsg.ToString()))); System.Diagnostics.Trace.WriteLine(String.Format("Enqueued '{0}'", msg)); } GetProgramContainer().GetBlockBlobReference(User.Identity.Name + "/" + projectName + "/" + TaskNameText.Text + "/" + ExeFile.FileName).UploadFromStream(ExeFile.FileContent); Server.Transfer("ViewTask.aspx"); }