protected virtual void OnJobSubmissionRecieved(JobSubmissionMessage e) { JobSubmissionRecievedEventHandler handler = JobSubmissionRecieved; if (handler != null) { // Invokes the delegates. handler(this, e); } }
public void ReceiveJobSubmitionMessage(JobSubmissionMessage sender) { this.OnJobSubmissionRecieved(sender); }
public void ServiceHost_JobSubmissionRecieved(object sender, JobSubmissionMessage e) { Trace.WriteLine("JobSubmissionRecieved Recieved User Id : " + e.idUsuario, "Warning"); try { // Obtener la cuenta de almacenamiento // Para actualizar metadatos CloudStorageAccount storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting("StorageConnectionString")); CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); CloudBlobContainer container = blobClient.GetContainerReference(VariablesConfiguracion.containerName); // Obtencion de variables para la conxion con el cluster string subscriptionID = VariablesConfiguracion.subscriptionID; string certFriendlyName = VariablesConfiguracion.certFriendlyName; string clusterName = VariablesConfiguracion.clusterName; // Definicion de la tarea MapReduce MapReduceJobCreateParameters mrJobDefinition = new MapReduceJobCreateParameters() { JarFile = "wasb:///CienciaCelularMR.jar", ClassName = "Main", StatusFolder = "wasb:///scicluster/test/status-" + e.idUsuario + "." + e.subIdUsuario, }; mrJobDefinition.Arguments.Add("wasb:///" + e.nomEntrada); mrJobDefinition.Arguments.Add("wasb:///scicluster/test/output-" + e.idUsuario + "." + e.subIdUsuario); // Obtener el objeto certificate X509Store store = new X509Store(); store.Open(OpenFlags.ReadOnly); X509Certificate2 cert = FindCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindByThumbprint, VariablesConfiguracion.thumbprint); JobSubmissionCertificateCredential creds = new JobSubmissionCertificateCredential(new Guid(subscriptionID), cert, clusterName); // Se crea un cliente Hadoop para conectarse con HDInsight var jobClient = JobSubmissionClientFactory.Connect(creds); //Actualizacion de metadatos CloudBlockBlob infoSimulation = container.GetBlockBlobReference(VariablesConfiguracion.infoSimulation + "-" + e.idUsuario); infoSimulation.UploadText(VariablesConfiguracion.JOB_STARTING); // Se lanza la ejecucion de los jobs MapReduce JobCreationResults mrJobResults = jobClient.CreateMapReduceJob(mrJobDefinition); // Esperar hasta que finalice la ejecucion WaitForJobCompletion(mrJobResults, jobClient, e.idUsuario, e.subIdUsuario); } catch (Exception ex) { Trace.TraceError(ex.Message); throw; } }