コード例 #1
0
        public override void ExecuteCmdlet()
        {
            var jobInfo             = DataLakeAnalyticsClient.GetJob(Account, JobId);
            var timeWaitedInSeconds = 0;

            while (jobInfo.State != JobState.Ended)
            {
                if (TimeoutInSeconds > 0 && timeWaitedInSeconds >= TimeoutInSeconds)
                {
                    throw new CloudException(string.Format(Resources.WaitJobTimeoutExceeded, JobId, TimeoutInSeconds));
                }

                WriteVerboseWithTimestamp(string.Format(Resources.WaitJobState, jobInfo.State));
                TestMockSupport.Delay(WaitIntervalInSeconds * 1000);
                timeWaitedInSeconds += WaitIntervalInSeconds;
                jobInfo              = DataLakeAnalyticsClient.GetJob(Account, JobId);
            }

            WriteObject(jobInfo);
        }
コード例 #2
0
        protected override void ProcessRecord()
        {
            var jobInfo             = DataLakeAnalyticsClient.GetJob(ResourceGroupName, Account, JobId);
            var timeWaitedInSeconds = 0;

            while (jobInfo.State != JobState.Ended)
            {
                if (TimeoutInSeconds > 0 && timeWaitedInSeconds >= TimeoutInSeconds)
                {
                    throw new CloudException(string.Format(Resources.WaitJobTimeoutExceeded, JobId, TimeoutInSeconds));
                }

                WriteVerboseWithTimestamp(string.Format(Resources.WaitJobState, jobInfo.State));
                Thread.Sleep(WaitIntervalInSeconds * 1000);
                timeWaitedInSeconds += WaitIntervalInSeconds;
                jobInfo              = DataLakeAnalyticsClient.GetJob(ResourceGroupName, Account, JobId);
            }

            WriteObject(jobInfo);
        }
コード例 #3
0
        public override void ExecuteCmdlet()
        {
            if (JobId != null && JobId != Guid.Empty)
            {
                // Get for single job
                var jobDetails = DataLakeAnalyticsClient.GetJob(Account, JobId);

                if (Include != DataLakeAnalyticsEnums.ExtendedJobData.None)
                {
                    if (jobDetails.Type != JobType.USql)
                    {
                        WriteWarningWithTimestamp(string.Format(Resources.AdditionalDataNotSupported, jobDetails.Type));
                    }
                    else
                    {
                        if (Include == DataLakeAnalyticsEnums.ExtendedJobData.All ||
                            Include == DataLakeAnalyticsEnums.ExtendedJobData.DebugInfo)
                        {
                            ((USqlJobProperties)jobDetails.Properties).DebugData =
                                DataLakeAnalyticsClient.GetDebugDataPaths(Account, JobId);
                        }

                        if (Include == DataLakeAnalyticsEnums.ExtendedJobData.All ||
                            Include == DataLakeAnalyticsEnums.ExtendedJobData.Statistics)
                        {
                            ((USqlJobProperties)jobDetails.Properties).Statistics =
                                DataLakeAnalyticsClient.GetJobStatistics(Account, JobId);
                        }
                    }
                }

                WriteObject(jobDetails);
            }
            else
            {
                var filter = new List <string>();
                if (!string.IsNullOrEmpty(Submitter))
                {
                    filter.Add(string.Format("submitter eq '{0}'", Submitter));
                }

                // due to issue: https://github.com/Azure/autorest/issues/975,
                // date time offsets must be explicitly escaped before being passed to the filter
                if (SubmittedAfter.HasValue)
                {
                    filter.Add(string.Format("submitTime ge datetimeoffset'{0}'", Uri.EscapeDataString(SubmittedAfter.Value.ToString("O"))));
                }

                // due to issue: https://github.com/Azure/autorest/issues/975,
                // date time offsets must be explicitly escaped before being passed to the filter
                if (SubmittedBefore.HasValue)
                {
                    filter.Add(string.Format("submitTime lt datetimeoffset'{0}'", Uri.EscapeDataString(SubmittedBefore.Value.ToString("O"))));
                }

                if (!string.IsNullOrEmpty(Name))
                {
                    filter.Add(string.Format("name eq '{0}'", Name));
                }

                if (State != null && State.Length > 0)
                {
                    filter.Add("(" +
                               string.Join(" or ",
                                           State.Select(state => string.Format("state eq '{0}'", state)).ToArray()) + ")");
                }

                if (Result != null && Result.Length > 0)
                {
                    filter.Add("(" +
                               string.Join(" or ",
                                           Result.Select(result => string.Format("result eq '{0}'", result)).ToArray()) + ")");
                }

                var filterString = string.Join(" and ", filter.ToArray());

                // List all accounts in given resource group if avaliable otherwise all accounts in the subscription
                var list = DataLakeAnalyticsClient.ListJobs(Account,
                                                            string.IsNullOrEmpty(filterString) ? null : filterString, null, null);
                WriteObject(list, true);
            }
        }
コード例 #4
0
        public override void ExecuteCmdlet()
        {
            if (JobId != null && JobId != Guid.Empty)
            {
                // Get for single job
                var jobDetails = DataLakeAnalyticsClient.GetJob(Account, JobId);

                if (Include != DataLakeAnalyticsEnums.ExtendedJobData.None)
                {
                    if (jobDetails.Type != JobType.USql)
                    {
                        WriteWarningWithTimestamp(string.Format(Resources.AdditionalDataNotSupported, jobDetails.Type));
                    }
                    else
                    {
                        if (Include == DataLakeAnalyticsEnums.ExtendedJobData.All ||
                            Include == DataLakeAnalyticsEnums.ExtendedJobData.DebugInfo)
                        {
                            ((USqlJobProperties)jobDetails.Properties).DebugData =
                                DataLakeAnalyticsClient.GetDebugDataPaths(Account, JobId);
                        }

                        if (Include == DataLakeAnalyticsEnums.ExtendedJobData.All ||
                            Include == DataLakeAnalyticsEnums.ExtendedJobData.Statistics)
                        {
                            ((USqlJobProperties)jobDetails.Properties).Statistics =
                                DataLakeAnalyticsClient.GetJobStatistics(Account, JobId);
                        }
                    }
                }

                WriteObject(jobDetails);
            }
            else
            {
                var filter = new List <string>();
                // always order by most recently submitted.
                if (!string.IsNullOrEmpty(Submitter))
                {
                    // TODO: replace with the wildcard substitution.
                    filter.Add(string.Format("submitter eq '{0}'", Submitter));
                }

                // due to issue: https://github.com/Azure/autorest/issues/975,
                // date time offsets must be explicitly escaped before being passed to the filter
                if (SubmittedAfter.HasValue)
                {
                    filter.Add(string.Format("submitTime ge datetimeoffset'{0}'", Uri.EscapeDataString(SubmittedAfter.Value.ToString("O"))));
                }

                // due to issue: https://github.com/Azure/autorest/issues/975,
                // date time offsets must be explicitly escaped before being passed to the filter
                if (SubmittedBefore.HasValue)
                {
                    filter.Add(string.Format("submitTime lt datetimeoffset'{0}'", Uri.EscapeDataString(SubmittedBefore.Value.ToString("O"))));
                }

                if (!string.IsNullOrEmpty(Name))
                {
                    // TODO: replace with the wildcard substitution.
                    filter.Add(string.Format("name eq '{0}'", Name));
                }

                if (State != null && State.Length > 0)
                {
                    filter.Add("(" +
                               string.Join(" or ",
                                           State.Select(state => string.Format("state eq '{0}'", state)).ToArray()) + ")");
                }

                if (Result != null && Result.Length > 0)
                {
                    filter.Add("(" +
                               string.Join(" or ",
                                           Result.Select(result => string.Format("result eq '{0}'", result)).ToArray()) + ")");
                }

                if (PipelineId.HasValue)
                {
                    filter.Add(string.Format("related/pipelineId eq guid'{0}'", PipelineId.Value));
                }

                if (RecurrenceId.HasValue)
                {
                    filter.Add(string.Format("related/recurrenceId eq guid'{0}'", RecurrenceId.Value));
                }

                var filterString = string.Join(" and ", filter.ToArray());

                // List the jobs with the given filters
                bool warnUser;
                var  list = DataLakeAnalyticsClient.ListJobs(Account,
                                                             string.IsNullOrEmpty(filterString) ? null : filterString, Top, null, "submitTime desc", out warnUser);
                if (warnUser)
                {
                    WriteWarning(string.Format(Resources.MoreJobsToGetWarning, Top.HasValue ? Top.Value : 500));
                }

                WriteObject(list, true);
            }
        }
コード例 #5
0
        public override void ExecuteCmdlet()
        {
            if (JobId != null && JobId != Guid.Empty)
            {
                // Get for single job
                var jobDetails = DataLakeAnalyticsClient.GetJob(ResourceGroupName, Account, JobId);

                if (Include != DataLakeAnalyticsEnums.ExtendedJobData.None)
                {
                    if (!jobDetails.Type.Equals(JobType.USql, StringComparison.InvariantCultureIgnoreCase))
                    {
                        WriteWarningWithTimestamp(string.Format(Resources.AdditionalDataNotSupported, jobDetails.Type));
                    }
                    else
                    {
                        if (Include == DataLakeAnalyticsEnums.ExtendedJobData.All ||
                            Include == DataLakeAnalyticsEnums.ExtendedJobData.DebugInfo)
                        {
                            ((USqlProperties)jobDetails.Properties).DebugData =
                                DataLakeAnalyticsClient.GetDebugDataPaths(ResourceGroupName, Account, JobId);
                        }

                        if (Include == DataLakeAnalyticsEnums.ExtendedJobData.All ||
                            Include == DataLakeAnalyticsEnums.ExtendedJobData.Statistics)
                        {
                            ((USqlProperties)jobDetails.Properties).Statistics =
                                DataLakeAnalyticsClient.GetJobStatistics(ResourceGroupName, Account, JobId);
                        }
                    }
                }

                WriteObject(jobDetails);
            }
            else
            {
                var filter = new List <string>();
                if (!string.IsNullOrEmpty(Submitter))
                {
                    filter.Add(string.Format("submitter eq '{0}'", Submitter));
                }

                if (SubmittedAfter.HasValue)
                {
                    filter.Add(string.Format("submitTime ge datetimeoffset'{0}'", SubmittedAfter.Value.ToString("O")));
                }

                if (SubmittedBefore.HasValue)
                {
                    filter.Add(string.Format("submitTime lt datetimeoffset'{0}'", SubmittedBefore.Value.ToString("O")));
                }

                if (!string.IsNullOrEmpty(Name))
                {
                    filter.Add(string.Format("name eq '{0}'", Name));
                }

                if (State != null && State.Length > 0)
                {
                    filter.Add("(" +
                               string.Join(" or ",
                                           State.Select(state => string.Format("state eq '{0}'", state)).ToArray()) + ")");
                }

                if (Result != null && Result.Length > 0)
                {
                    filter.Add("(" +
                               string.Join(" or ",
                                           Result.Select(result => string.Format("result eq '{0}'", result)).ToArray()) + ")");
                }

                var filterString = string.Join(" and ", filter.ToArray());

                // List all accounts in given resource group if avaliable otherwise all accounts in the subscription
                var list = DataLakeAnalyticsClient.ListJobs(ResourceGroupName, Account,
                                                            string.IsNullOrEmpty(filterString) ? null : filterString, null, null);
                WriteObject(list, true);
            }
        }