protected virtual async Task <AzureHDInsightJob> StartJob( AzureHDInsightJobDefinition jobDefinition, AzureHDInsightClusterConnection currentConnection) { jobDefinition.ArgumentNotNull("jobDefinition"); currentConnection.ArgumentNotNull("currentCluster"); this.ValidateNotCanceled(); var startJobCommand = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateStartJob(); this.SetClient(startJobCommand); startJobCommand.Cluster = currentConnection.Cluster.Name; startJobCommand.Logger = this.Logger; startJobCommand.CurrentSubscription = this.CurrentSubscription; startJobCommand.JobDefinition = jobDefinition; this.ValidateNotCanceled(); await startJobCommand.EndProcessing(); return(startJobCommand.Output.Last()); }
protected virtual async Task <AzureHDInsightJob> WaitForCompletion( AzureHDInsightJob startedJob, AzureHDInsightClusterConnection currentConnection) { startedJob.ArgumentNotNull("startedJob"); currentConnection.ArgumentNotNull("currentConnection"); this.ValidateNotCanceled(); var waitJobCommand = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateWaitJobs(); waitJobCommand.JobStatusEvent += this.ClientOnJobStatus; this.SetClient(waitJobCommand); waitJobCommand.Job = startedJob; waitJobCommand.Logger = this.Logger; waitJobCommand.WaitTimeoutInSeconds = WaitAnHourInSeconds; waitJobCommand.CurrentSubscription = this.CurrentSubscription; this.ValidateNotCanceled(); await waitJobCommand.ProcessRecord(); return(waitJobCommand.Output.Last()); }
protected virtual async Task WriteJobSuccess(AzureHDInsightJob completedJob, AzureHDInsightClusterConnection currentConnection) { completedJob.ArgumentNotNull("completedJob"); currentConnection.ArgumentNotNull("currentConnection"); this.WriteOutput("Hive query completed Successfully"); this.WriteOutput(Environment.NewLine); this.ValidateNotCanceled(); var getJobOutputCommand = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateGetJobOutput(); this.SetClient(getJobOutputCommand); getJobOutputCommand.JobId = completedJob.JobId; getJobOutputCommand.Logger = this.Logger; getJobOutputCommand.CurrentSubscription = this.CurrentSubscription; getJobOutputCommand.Cluster = currentConnection.Cluster.Name; this.ValidateNotCanceled(); await getJobOutputCommand.EndProcessing(); var outputStream = getJobOutputCommand.Output.First(); string content = new StreamReader(outputStream).ReadToEnd(); this.WriteOutput(content); }
protected virtual async Task WriteJobSuccess(AzureHDInsightJob completedJob, AzureHDInsightClusterConnection currentConnection) { completedJob.ArgumentNotNull("completedJob"); currentConnection.ArgumentNotNull("currentConnection"); this.WriteOutput("Hive query completed Successfully"); this.WriteOutput(Environment.NewLine); this.ValidateNotCanceled(); var getJobOutputCommand = ServiceLocator.Instance.Locate<IAzureHDInsightCommandFactory>().CreateGetJobOutput(); this.SetClient(getJobOutputCommand); getJobOutputCommand.JobId = completedJob.JobId; getJobOutputCommand.Logger = this.Logger; getJobOutputCommand.CurrentSubscription = this.CurrentSubscription; getJobOutputCommand.Cluster = currentConnection.Cluster.Name; this.ValidateNotCanceled(); await getJobOutputCommand.EndProcessing(); var outputStream = getJobOutputCommand.Output.First(); string content = new StreamReader(outputStream).ReadToEnd(); this.WriteOutput(content); }
protected virtual async Task<AzureHDInsightJob> WaitForCompletion( AzureHDInsightJob startedJob, AzureHDInsightClusterConnection currentConnection) { startedJob.ArgumentNotNull("startedJob"); currentConnection.ArgumentNotNull("currentConnection"); this.ValidateNotCanceled(); var waitJobCommand = ServiceLocator.Instance.Locate<IAzureHDInsightCommandFactory>().CreateWaitJobs(); waitJobCommand.JobStatusEvent += this.ClientOnJobStatus; this.SetClient(waitJobCommand); waitJobCommand.Job = startedJob; waitJobCommand.Logger = this.Logger; waitJobCommand.WaitTimeoutInSeconds = WaitAnHourInSeconds; waitJobCommand.CurrentSubscription = this.CurrentSubscription; this.ValidateNotCanceled(); await waitJobCommand.ProcessRecord(); return waitJobCommand.Output.Last(); }
protected virtual async Task<AzureHDInsightJob> StartJob( AzureHDInsightJobDefinition jobDefinition, AzureHDInsightClusterConnection currentConnection) { jobDefinition.ArgumentNotNull("jobDefinition"); currentConnection.ArgumentNotNull("currentCluster"); this.ValidateNotCanceled(); var startJobCommand = ServiceLocator.Instance.Locate<IAzureHDInsightCommandFactory>().CreateStartJob(); this.SetClient(startJobCommand); startJobCommand.Cluster = currentConnection.Cluster.Name; startJobCommand.Logger = this.Logger; startJobCommand.CurrentSubscription = this.CurrentSubscription; startJobCommand.JobDefinition = jobDefinition; this.ValidateNotCanceled(); await startJobCommand.EndProcessing(); return startJobCommand.Output.Last(); }