/// <summary> /// Helper function to run each of the tasks defined in the job /// </summary> /// <param name="executeables">Array of tasks to execute.</param> /// <returns>True if all tasks completed successfully. False otherwise.</returns> private bool RunJobTasks(Executeable[] executeables) { bool successful = true; for (int i = 0; i < executeables.Length; i++) { successful = RunTask(executeables[i].Path, executeables[i].Arguments); if (!successful) { break; } } return successful; }
public static void CreateQueueMessage( string accountName, string accountKey, string queueName, Executeable[] executeables, string[] inputFiles, string[] outFiles, string[] removeFiles) { var storageAccount = new CloudStorageAccount( new StorageCredentialsAccountAndKey(accountName, accountKey), false); CloudQueueClient queueStorage = storageAccount.CreateCloudQueueClient(); var jobQueue = queueStorage.GetQueueReference(queueName); jobQueue.CreateIfNotExist(); var message = new StahcJob() { Executables = executeables, InputFiles = inputFiles, OutputFiles = outFiles, FilesToRemove = removeFiles }; XmlSerializer serializer = new XmlSerializer(typeof(StahcJob)); using (StringWriter sw1 = new StringWriter()) { serializer.Serialize(sw1, message); // Put message on queue CloudQueueMessage cloudMessage = new CloudQueueMessage(sw1.ToString()); jobQueue.AddMessage(cloudMessage); } }