protected async Task UpdateJobInformationRecordAsync(string description, string warning = null, JobInformation jobInformation = null, Exception exception = null) { try { if (jobInformation != null) { JobInformation = jobInformation; } JobInformation.ResultDescription = description; JobInformation.EndDateTimeUTC = DateTime.UtcNow; JobInformation.WarningDescription = warning; if (exception == null) { JobInformation.IsFinishedWithError = false; } else { JobInformation.IsFinishedWithError = true; JobInformation.ErrorDescription = exception.ToString(); } await JobInformationService.UpdateAsync(JobInformation); } catch (Exception updateException) { Logger.LogError(updateException, "Error while updating job information record."); } }
public async Task <IActionResult> Edit(int id, [Bind("JobId,Department,JobInvolvement,JobLevel,JobRole")] JobInformation jobInformation) { if (id != jobInformation.JobId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(jobInformation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JobInformationExists(jobInformation.JobId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(jobInformation)); }
public async Task <IActionResult> Edit(int id, [Bind("JobId,BusinessTravel,Department,EmployeeNumber,JobInvolvement,JobLevel,JobRole")] JobInformation jobInformation) { if (id != jobInformation.JobId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(jobInformation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JobInformationExists(jobInformation.JobId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EmployeeNumber"] = new SelectList(_context.EmployeeDetails, "EmployeeNumber", "EmployeeNumber", jobInformation.EmployeeNumber); return(View(jobInformation)); }
public async Task <Guid> SubmitJobAsync(string jobName, string script, Dictionary <string, object> variables = null, bool showScriptOnOutput = false) { if (variables != null) { StringBuilder sb = new StringBuilder(); foreach (var kvp in variables) { sb.AppendLine($"DECLARE @{kvp.Key} = \"{kvp.Value}\";"); } sb.Append(script); script = sb.ToString(); } if (showScriptOnOutput) { Console.WriteLine(script); } var jobId = Guid.NewGuid(); var properties = new USqlJobProperties(script); var jobParameters = new JobInformation(jobName, JobType.USql, properties, priority: 1, degreeOfParallelism: 1, jobId: jobId); await _dlaJobClient.Job.CreateAsync(_dlaAccountName, jobId, jobParameters); return(jobId); }
public void create_job_and_pass_parameters() { var jobClient = new DataLakeAnalyticsJobManagementClient(_serviceClientCredentials); var ji = new JobInformation("a job", JobType.USql, new USqlJobProperties(_script_with_parameters)); // TODO: how to pass parameters marked as external without injection into the script? //var jobInfo = jobClient.Job.Create(TestsConfiguration.AccountAnalytics, Guid.NewGuid(), ji); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,FunctionalAreaId,JobLocation,AgeLimit,YearsOfExperience,Qualification,Requirements,Responsibility,JobSummary,IndustryId,Renumeration,CompanyId,JobTypeId")] JobInformation jobInformation) { if (id != jobInformation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _repo.Update(jobInformation); await _repo.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(RedirectToAction(nameof(Index))); } ViewData["FunctionalAreaId"] = new SelectList(_repo.FunctionalAreas, "Id", "Id", jobInformation.FunctionalAreaId); ViewData["IndustryId"] = new SelectList(_repo.Industries, "Id", "Id", jobInformation.IndustryId); ViewData["JobTypeId"] = new SelectList(_repo.JobTypes, "Id", "Id", jobInformation.JobTypeId); return(View(jobInformation)); }
protected async Task CreateJobInformationRecordAsync(JobInformation jobInformation = null) { try { if (jobInformation == null) { var jobData = JobExecutionContext.MergedJobDataMap; JobTriggerType triggerType = jobData.ContainsKey("JobTriggerType") ? (JobTriggerType)jobData["JobTriggerType"] : JobTriggerType.Automatic; JobInformation = new JobInformation() { TriggerType = triggerType, StartDateTimeUTC = DateTime.UtcNow, JobName = JobName }; } else { JobInformation = jobInformation; } await JobInformationService.CreateAsync(JobInformation); } catch (Exception exception) { Logger.LogError(exception, "Error while creating job information record."); } }
private static Guid SubmitJobByPath( string scriptPath, string fileName, string dataSource, string jobName, int degreeOfParallelism = 250) { var script = File.ReadAllText(scriptPath); script = script.Replace("[FILENAME]", fileName); script = script.Replace("[DATASOURCE]", dataSource); var jobId = Guid.NewGuid(); var properties = new USqlJobProperties(script); var parameters = new JobInformation( jobName, JobType.USql, properties, priority: 1, degreeOfParallelism: degreeOfParallelism, jobId: jobId); var jobInfo = _adlaJobClient.Job.Create("shield", jobId, parameters); return(jobId); }
// GET: CompanyJob public ActionResult Index() { List <JobInformation> jobInfoList = new List <JobInformation>(); //Company Job via WebAPI var request = new RestRequest("api/careercloud/company/v1/job"); var response = client.Execute <CompanyJobPoco>(request); var companyJobs = JsonConvert.DeserializeObject <IEnumerable <CompanyJobPoco> >(response.Content); foreach (var companyJob in companyJobs) { JobInformation jobInformation = new JobInformation(); CompanyJobDescriptionPoco companyJobDescriptionPoco; jobInformation.profileCreated = companyJob.ProfileCreated; jobInformation.companyJobPoco = companyJob; CompanyJobDescriptionRepository companyJobDescriptionRepository = new CompanyJobDescriptionRepository(); CompanyJobDescriptionLogic companyJobDescriptionLogic = new CompanyJobDescriptionLogic(companyJobDescriptionRepository); companyJobDescriptionPoco = companyJobDescriptionLogic.GetAll().Where(s => s.Job == companyJob.Id).FirstOrDefault(); if (companyJobDescriptionPoco == null) { continue; } jobInformation.jobName = companyJobDescriptionPoco.JobName; jobInformation.jobDescription = companyJobDescriptionPoco.JobDescriptions; CompanyProfilePoco companyProfilePoco; CompanyProfileRepository companyProfileRepository = new CompanyProfileRepository(); CompanyProfileLogic companyProfileLogic = new CompanyProfileLogic(companyProfileRepository); companyProfilePoco = companyProfileLogic.GetAll().Where(s => s.Id == companyJob.Company).FirstOrDefault(); if (companyProfilePoco == null) { continue; } CompanyDescriptionPoco companyDescriptionPoco; CompanyDescriptionRepository companyDescriptionRepository = new CompanyDescriptionRepository(); CompanyDescriptionLogic companyDescriptionLogic = new CompanyDescriptionLogic(companyDescriptionRepository); companyDescriptionPoco = companyDescriptionLogic.GetAll().Where(s => s.Company == companyProfilePoco.Id).FirstOrDefault(); if (companyDescriptionPoco == null) { continue; } jobInformation.companyName = companyDescriptionPoco.CompanyName; jobInfoList.Add(jobInformation); } return(View(jobInfoList)); }
public void create_job() { var jobClient = new DataLakeAnalyticsJobManagementClient(_serviceClientCredentials); var ji = new JobInformation("a job create_job", JobType.USql, new USqlJobProperties(_script)); var jobInfo = jobClient.Job.CreateWithHttpMessagesAsync(TestsConfiguration.AccountAnalytics, Guid.NewGuid(), ji).GetAwaiter().GetResult(); jobInfo.Response.IsSuccessStatusCode.Should().BeTrue(); }
public void create_job_using_extension() { var jobClient = new DataLakeAnalyticsJobManagementClient(_serviceClientCredentials); var ji = new JobInformation("a job create_job_using_extension", JobType.USql, new USqlJobProperties(_script), Guid.Empty); var jobInfo = jobClient.Job.Create(TestsConfiguration.AccountAnalytics, Guid.NewGuid(), ji); jobInfo.Should().NotBeNull(); }
public ActionResult DeleteConfirmed(int id) { JobInformation jobInformation = db.JobInformations.Find(id); db.JobInformations.Remove(jobInformation); db.SaveChanges(); return(RedirectToAction("Index")); }
public override void Initialize(string type) { base.Initialize(type); // if there is no JobInfo defined, use defaults (time=0, ...) if (JobInfo == null) { JobInfo = new JobInformation(); } }
// Submit a U-SQL job by providing script contents. // Returns the job ID public static string SubmitJobByScript(string script, string jobName) { var jobId = Guid.NewGuid(); var properties = new USqlJobProperties(script); var parameters = new JobInformation(jobName, JobType.USql, properties); var jobInfo = _adlaJobClient.Job.Create(_adlaAccountName, jobId, parameters); return(jobId.ToString()); }
public ActionResult Details(string companyName, string jobName, string jobDescription, DateTime profileCreated) { JobInformation jobInformation = new JobInformation(); jobInformation.companyName = companyName; jobInformation.jobName = jobName; jobInformation.jobDescription = jobDescription; jobInformation.profileCreated = profileCreated; return(View(jobInformation)); }
// Submit a U-SQL job by providing a path to the script public static string SubmitJobByPath(string scriptPath, string jobName) { var script = File.ReadAllText(scriptPath); var jobId = Guid.NewGuid(); var properties = new USqlJobProperties(script); var parameters = new JobInformation(jobName, JobType.USql, properties, priority: 1000, degreeOfParallelism: 1); var jobInfo = _adlaJobClient.Job.Create(_adlaAccountName, jobId, parameters); return(jobId.ToString()); }
public ActionResult Edit([Bind(Include = "Id,Job_Position,Company_Name,Work_Address,Job_Description,Job_Requirement,Person_to_Contact,Contact_Number,Contact_Email,Other_Notes")] JobInformation jobInformation) { if (ModelState.IsValid) { db.Entry(jobInformation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Person_to_Contact = new SelectList(db.Employees, "Account_Name", "Password", jobInformation.Person_to_Contact); return(View(jobInformation)); }
public WindowTesting(string transformerSerialNo, string jobName, JobInformation job, int testID = -1, bool istcp = false) { InitializeComponent(); Started = false; this.DataContext = this; currentJob = WorkingSets.local.getJob(transformerSerialNo, jobName); TestingWorker = new BackgroundWorker(); TestingWorker.WorkerReportsProgress = true; TestingWorker.WorkerSupportsCancellation = true; TestingWorker.DoWork += TestingWorker_DoWork; TestingWorker.ProgressChanged += TestingWorker_ProgressChanged; TestingWorker.RunWorkerCompleted += TestingWorker_RunWorkerCompleted; if (testID < 0) { worker = new TestingWorkerSender() { Transformer = currentJob.Transformer, job = currentJob, MeasurementItems = Translator.JobList2MeasurementItems(currentJob).ToArray(), CurrentItemIndex = 0, ProgressPercent = 0 } } ; else { worker = TestingWorkerSender.FromDatabaseRows(testID); } StatusRefresh(worker); if (istcp) { currentJob.Information = job; } else { TestingInfoWindow testingInfoWindow = new TestingInfoWindow(worker); if (testingInfoWindow.ShowDialog() != true) { // currentJob.Information = testingInfoWindow.Information; inited = false; } else { currentJob.Information = testingInfoWindow.Information; var a = currentJob.Information.GetHashCode(); worker.job = currentJob; inited = true; } } SetgroupboxVisible(Whichgroupbox.READY); }
public async Task <IActionResult> Create([Bind("JobId,Department,JobInvolvement,JobLevel,JobRole")] JobInformation jobInformation) { if (ModelState.IsValid) { _context.Add(jobInformation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(jobInformation)); }
public Guid SubmitJobByPath(string scriptPath, string jobName) { var script = File.ReadAllText(scriptPath); var jobId = Guid.NewGuid(); var properties = new USqlJobProperties(script); var parameters = new JobInformation(jobName, JobType.USql, properties, priority: 1, degreeOfParallelism: 1, jobId: jobId); var jobInfo = _adlaJobClient.Job.Create(_adlaAccountName, jobId, parameters); Console.WriteLine($"{jobInfo.StartTime}"); return(jobId); }
public async Task <IActionResult> Create([Bind("JobId,BusinessTravel,Department,EmployeeNumber,JobInvolvement,JobLevel,JobRole")] JobInformation jobInformation) { if (ModelState.IsValid) { _context.Add(jobInformation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EmployeeNumber"] = new SelectList(_context.EmployeeDetails, "EmployeeNumber", "EmployeeNumber", jobInformation.EmployeeNumber); return(View(jobInformation)); }
public JobInformation BuildJob(string resourceGroupName, string accountName, JobInformation jobToBuild) { if (string.IsNullOrEmpty(resourceGroupName)) { resourceGroupName = GetResourceGroupByAccountName(accountName); } return (_jobClient.Jobs.Build(resourceGroupName, accountName, new JobInfoBuildOrCreateParameters { Job = jobToBuild }).Job); }
public async Task <IActionResult> Create([Bind("Id,Name,FunctionalAreaId,JobLocation,AgeLimit,YearsOfExperience,Qualification,Requirements,Responsibility,JobSummary,IndustryId,Renumeration,CompanyId,JobTypeId")] JobInformation jobInformation) { if (ModelState.IsValid) { _repo.Add(jobInformation); await _repo.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FunctionalAreaId"] = new SelectList(_repo.FunctionalAreas, "Id", "Id", jobInformation.FunctionalAreaId); ViewData["IndustryId"] = new SelectList(_repo.Industries, "Id", "Id", jobInformation.IndustryId); ViewData["JobTypeId"] = new SelectList(_repo.JobTypes, "Id", "Id", jobInformation.JobTypeId); return(View(jobInformation)); }
// GET: JobInformations/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JobInformation jobInformation = db.JobInformations.Find(id); if (jobInformation == null) { return(HttpNotFound()); } return(View(jobInformation)); }
private void Awake() { currentCurreny1Profit = initialCurrency1Profit; currentCurrency2Profit = initialCurrency2Profit; yellowBackImage = this.GetComponent <RawImage>(); gUI.initializeCard(title, initialCurrency1Profit, initialCurrency2Profit, Currency1GrowthRate, Currency2GrowthRate, currentCurreny1Profit, currentCurrency2Profit, yellowBackImage); jobStruct = new JobInformation(); jobStruct.initialize(title, initialCurrency1Profit, initialCurrency2Profit, Currency1GrowthRate, Currency2GrowthRate, currentCurreny1Profit, currentCurrency2Profit, jobTypeEnum); panelButton = gUI.getPanelButton(); }
public static Guid SubmitJobByPath(string scriptPath, string jobName) { System.IO.Stream stream = new System.IO.MemoryStream(); _adlsFileSystemClient.FileSystem.Open(_adlsAccountName, scriptPath).CopyToAsync(stream); string script = StreamToString(stream); stream.Dispose(); var jobId = Guid.NewGuid(); var properties = new USqlJobProperties(script); var parameters = new JobInformation(jobName, JobType.USql, properties, priority: 1, degreeOfParallelism: 1, jobId: jobId); var jobInfo = _adlaJobClient.Job.Create(_adlaAccountName, jobId, parameters); return(jobId); }
// GET: JobInformations/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JobInformation jobInformation = db.JobInformations.Find(id); if (jobInformation == null) { return(HttpNotFound()); } ViewBag.Person_to_Contact = new SelectList(db.Employees, "Account_Name", "Password", jobInformation.Person_to_Contact); return(View(jobInformation)); }
public void create_job_and_wait() { var jobClient = new DataLakeAnalyticsJobManagementClient(_serviceClientCredentials); var ji = new JobInformation("a job create_job_and_wait", JobType.USql, new USqlJobProperties(_script), Guid.Empty); var jobInfo = jobClient.Job.Create(TestsConfiguration.AccountAnalytics, Guid.NewGuid(), ji); bool done = false; do { Thread.Sleep(TimeSpan.FromSeconds(3)); var jobWaitInfo = jobClient.Job.Get(TestsConfiguration.AccountAnalytics, jobInfo.JobId.Value); done = jobWaitInfo.State == JobState.Ended; Debug.WriteLine($"State: {jobWaitInfo.State?.ToString() ?? "null"}"); } while (!done); }
/// <summary>Handle notifications</summary> /// <param name="notification">the job event notification to print</param> /// <param name="type">an arbotrary object passed when this listener is registered, may be null</param> public override void HandleNotification(Notification notification, object handback) { JobNotification notif = notification as JobNotification; if (notif != null) { JobEventType type = notif.getEventType(); // skip job updated notifications if (type != JobEventType.JOB_UPDATED) { JobInformation jobInfo = notif.getJobInformation(); int n = jobInfo.getTaskCount(); Console.WriteLine("[MyJobNotificationListener] job '" + jobInfo.getJobName() + "' received " + type + " notification" + (n > 0 ? " for " + n + " tasks" : "") + ", handback = " + (handback != null ? "" + handback : "null")); } } }
internal Guid RunJobToCompletion(DataLakeAnalyticsJobManagementClient jobClient, string dataLakeAnalyticsAccountName, Guid jobIdToUse, string scriptToRun) { var createOrBuildParams = new JobInformation { Name = TestUtilities.GenerateName("testjob1"), Type = JobType.USql, DegreeOfParallelism = 2, Properties = new USqlJobProperties { // Type = JobType.USql, Script = scriptToRun }, JobId = jobIdToUse }; var jobCreateResponse = jobClient.Job.Create(dataLakeAnalyticsAccountName, jobIdToUse, createOrBuildParams); Assert.NotNull(jobCreateResponse); // Poll the job until it finishes var getJobResponse = jobClient.Job.Get(dataLakeAnalyticsAccountName, jobCreateResponse.JobId.GetValueOrDefault()); Assert.NotNull(getJobResponse); int maxWaitInSeconds = 180; // 3 minutes should be long enough int curWaitInSeconds = 0; while (getJobResponse.State != JobState.Ended && curWaitInSeconds < maxWaitInSeconds) { // wait 5 seconds before polling again TestUtilities.Wait(5000); curWaitInSeconds += 5; getJobResponse = jobClient.Job.Get(dataLakeAnalyticsAccountName, jobCreateResponse.JobId.GetValueOrDefault()); Assert.NotNull(getJobResponse); } Assert.True(curWaitInSeconds <= maxWaitInSeconds); // Verify the job completes successfully Assert.True( getJobResponse.State == JobState.Ended && getJobResponse.Result == JobResult.Succeeded, string.Format( "Job: {0} did not return success. Current job state: {1}. Actual result: {2}. Error (if any): {3}", getJobResponse.JobId, getJobResponse.State, getJobResponse.Result, getJobResponse.ErrorMessage != null && getJobResponse.ErrorMessage.Count > 0 ? getJobResponse.ErrorMessage[0].Details : "no error information returned")); return(getJobResponse.JobId.GetValueOrDefault()); }
public JobInformation BuildJob(string resourceGroupName, string accountName, JobInformation jobToBuild) { if (string.IsNullOrEmpty(resourceGroupName)) { resourceGroupName = GetResourceGroupByAccountName(accountName); } return _jobClient.Jobs.Build(resourceGroupName, accountName, new JobInfoBuildOrCreateParameters {Job = jobToBuild}).Job; }
public void SubmitGetListCancelTest() { TestUtilities.StartTest(); try { UndoContext.Current.Start(); CommonTestFixture commonData = new CommonTestFixture(); var clientToUse = this.GetDataLakeAnalyticsJobManagementClient(); var accountClient = this.GetDataLakeAnalyticsManagementClient(); // Create a test account to submit the job to. AzureAsyncOperationResponse responseCreate = accountClient.DataLakeAnalyticsAccount.Create(resourceGroupName: commonData.ResourceGroupName, parameters: new DataLakeAnalyticsAccountCreateOrUpdateParameters { DataLakeAnalyticsAccount = new DataLakeAnalyticsAccount { Name = commonData.DataLakeAnalyticsAccountName, Location = commonData.Location, Properties = new DataLakeAnalyticsAccountProperties { DefaultDataLakeStoreAccount = commonData.DataLakeAccountName, DataLakeStoreAccounts = new List<DataLakeStoreAccount> { { new DataLakeStoreAccount { Name = commonData.DataLakeAccountName, Properties = new DataLakeStoreAccountProperties { Suffix = commonData.DataLakeAccountSuffix } } } } }, Tags = new Dictionary<string, string> { { "testkey","testvalue" } } } }); Assert.True(responseCreate.Status == OperationStatus.Succeeded); // wait for provisioning state to be Succeeded // we will wait a maximum of 15 minutes for this to happen and then report failures DataLakeAnalyticsAccountGetResponse getResponse = accountClient.DataLakeAnalyticsAccount.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName); int timeToWaitInMinutes = 15; int minutesWaited = 0; while (getResponse.DataLakeAnalyticsAccount.Properties.ProvisioningState != DataLakeAnalyticsAccountStatus.Succeeded && getResponse.DataLakeAnalyticsAccount.Properties.ProvisioningState != DataLakeAnalyticsAccountStatus.Failed && getResponse.DataLakeAnalyticsAccount.Properties.ProvisioningState != DataLakeAnalyticsAccountStatus.Failed && minutesWaited <= timeToWaitInMinutes) { TestUtilities.Wait(60000); // Wait for one minute and then go again. minutesWaited++; getResponse = accountClient.DataLakeAnalyticsAccount.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName); } // Confirm that the account creation did succeed Assert.True(getResponse.DataLakeAnalyticsAccount.Properties.ProvisioningState == DataLakeAnalyticsAccountStatus.Succeeded); // TODO: Remove this sleep once defect 5022906 is fixed TestUtilities.Wait(120000); // Wait for two minutes to submit the job, which gives the CJS queue a chance to create. // We need to hardcode the job ID to use for the mocks. // TODO: come up with some way to re-generate this when necessary (i.e. re-running/running the test against the server). Guid jobId = TestUtilities.GenerateGuid(); var secondId = TestUtilities.GenerateGuid(); // Submit a job to the account var jobToSubmit = new JobInformation { Name = "azure sdk data lake analytics job", JobId = jobId, DegreeOfParallelism = 2, Type = JobType.USql, Properties = new USqlProperties { Type = JobType.USql, Script = "DROP DATABASE IF EXISTS testdb; CREATE DATABASE testdb;" } }; var createOrBuildParams = new JobInfoBuildOrCreateParameters { Job = jobToSubmit }; JobInfoBuildOrCreateResponse jobCreateResponse = clientToUse.Jobs.Create(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, createOrBuildParams); // TODO: Once the front end is no longer mocked, do response validation here as well as for all other requests Assert.NotNull(jobCreateResponse); // Cancel the job AzureOperationResponse cancelJobResponse = clientToUse.Jobs.Cancel(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, jobCreateResponse.Job.JobId); // Verify the job was successfully cancelled Assert.NotNull(cancelJobResponse); Assert.Equal(HttpStatusCode.OK, cancelJobResponse.StatusCode); // Get the job and ensure that it says it was cancelled. var getCancelledJobResponse = clientToUse.Jobs.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, jobCreateResponse.Job.JobId); Assert.Equal(HttpStatusCode.OK, getCancelledJobResponse.StatusCode); Assert.Equal(JobResult.Cancelled, getCancelledJobResponse.Job.Result); Assert.NotNull(getCancelledJobResponse.Job.ErrorMessage); Assert.NotEmpty(getCancelledJobResponse.Job.ErrorMessage); // Resubmit the job createOrBuildParams.Job.JobId = secondId; jobCreateResponse = clientToUse.Jobs.Create(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, createOrBuildParams); Assert.NotNull(jobCreateResponse); // Poll the job until it finishes JobInfoGetResponse getJobResponse = clientToUse.Jobs.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, jobCreateResponse.Job.JobId); Assert.NotNull(getJobResponse); int maxWaitInSeconds = 180; // 3 minutes should be long enough int curWaitInSeconds = 0; while (getJobResponse.Job.State != JobState.Ended && curWaitInSeconds < maxWaitInSeconds) { // wait 5 seconds before polling again TestUtilities.Wait(5000); curWaitInSeconds += 5; getJobResponse = clientToUse.Jobs.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, jobCreateResponse.Job.JobId); Assert.NotNull(getJobResponse); } Assert.True(curWaitInSeconds <= maxWaitInSeconds); // Verify the job completes successfully Assert.True( getJobResponse.Job.State == JobState.Ended && getJobResponse.Job.Result == JobResult.Succeeded, string.Format("Job: {0} did not return success. Current job state: {1}. Actual result: {2}. Error (if any): {3}", getJobResponse.Job.JobId, getJobResponse.Job.State, getJobResponse.Job.Result, getJobResponse.Job.ErrorMessage)); JobInfoListResponse listJobResponse = clientToUse.Jobs.List(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, null); Assert.NotNull(listJobResponse); Assert.True(listJobResponse.Value.Any(job => job.JobId == getJobResponse.Job.JobId)); // Just compile the job var compileResponse = clientToUse.Jobs.Build(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, createOrBuildParams); // list the jobs both with a hand crafted query string and using the parameters listJobResponse = clientToUse.Jobs.List(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, new JobListParameters {Select = "jobId"} ); Assert.NotNull(listJobResponse); Assert.True(listJobResponse.Value.Any(job => job.JobId == getJobResponse.Job.JobId)); Assert.NotNull(compileResponse); listJobResponse = clientToUse.Jobs.ListWithQueryString(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, "$select=jobId"); Assert.NotNull(listJobResponse); Assert.True(listJobResponse.Value.Any(job => job.JobId == getJobResponse.Job.JobId)); Assert.NotNull(compileResponse); } finally { // we don't catch any exceptions, those should all be bubbled up. UndoContext.Current.UndoAll(); TestUtilities.EndTest(); } }