static void RunJob(JobSettings job, CommandLineArguments cmdArgs) { System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); watch.Start(); try { var errorHandler = new Core.Services.DefaultErrorHandler(); job.CurrentEnvironment = cmdArgs.Environment; if (cmdArgs.Export) { Exporter.Instance.Run(job, cmdArgs.Environment, errorHandler); } if (cmdArgs.Import) { Importer.Instance.Run(job, cmdArgs.Environment, errorHandler); } if (cmdArgs.ImportScript) { var importScriptGenerator = GenerateImportScript.Instance; importScriptGenerator.Filename = cmdArgs.ImportScriptName; GenerateImportScript.Instance.Run(job, cmdArgs.Environment, errorHandler); } } catch (DbSyncException ex) { var foregroundColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.Error.WriteLine($"Job failed"); Console.ForegroundColor = foregroundColor; } watch.Stop(); Console.WriteLine($"Executed job {job.Name}, Elapsed {watch.ElapsedMilliseconds}ms"); }
public Uri InvokeTriggeredJob(string jobName, string arguments, string trigger) { TriggeredJob triggeredJob = GetJob(jobName); if (triggeredJob == null) { throw new JobNotFoundException($"Cannot find '{jobName}' triggered job"); } triggeredJob.CommandArguments = arguments; if (IsShuttingdown) { throw new WebJobsStoppedException(); } TriggeredJobRunner triggeredJobRunner = _triggeredJobRunners.GetOrAdd( jobName, _ => new TriggeredJobRunner(triggeredJob.Name, JobsBinariesPath, Environment, Settings, TraceFactory, Analytics)); JobSettings jobSettings = triggeredJob.Settings; string runId = triggeredJobRunner.StartJobRun(triggeredJob, jobSettings, trigger, ReportTriggeredJobFinished); ClearJobListCache(); return(BuildJobsUrl("{0}/history/{1}".FormatInvariant(jobName, runId))); }
public virtual void ShootAtTarget(GuardJobInstance instance, ref NPCBase.NPCState state) { if (state.Inventory.TryRemove(GuardSettings.ShootItem)) { if (GuardSettings.OnShootAudio != null) { AudioManager.SendAudio(instance.Position.Vector, GuardSettings.OnShootAudio); } if (GuardSettings.OnHitAudio != null) { AudioManager.SendAudio(instance.Target.PositionToAimFor, GuardSettings.OnHitAudio); } UnityEngine.Vector3 start = instance.Position.Add(0, 1, 0).Vector; UnityEngine.Vector3 end = instance.Target.PositionToAimFor; UnityEngine.Vector3 dirNormalized = (end - start).normalized; ServerManager.SendParticleTrail(start + dirNormalized * 0.15f, end - dirNormalized * 0.15f, Pipliz.Random.NextFloat(1.5f, 2.5f)); instance.Target.OnHit(GuardSettings.Damage, instance.NPC, ModLoader.OnHitData.EHitSourceType.NPC); state.SetIndicator(new IndicatorState(GuardSettings.CooldownShot, GuardSettings.ShootItem[0].Type)); if (GuardSettings.OnShootResultItem.item.Type > 0 && Pipliz.Random.NextDouble(0.0, 1.0) <= (double)GuardSettings.OnShootResultItem.chance) { instance.Owner.Stockpile.Add(GuardSettings.OnShootResultItem.item); } } else { var items = GuardSettings.ShootItem.Select(i => new StoredItem(i.Type, i.Amount * 50)).ToArray(); var getitemsfromCrate = new GetItemsFromCrateGoal(instance, JobSettings, this, items); JobSettings.SetGoal(instance, new PutItemsInCrateGoal(Job, JobSettings, getitemsfromCrate, state.Inventory.Inventory), ref state); state.Inventory.Add(items); } }
void master_JobComplete(object sender, EventArgs e) { // propagate master's event onJobComplete(); // no job set this.jobSettings = null; }
private static JobSettings CreateEmptyJobSettings() { var settings = new JobSettings { Name = "(temp) Arcus Templates - Integration Testing", NewCluster = new ClusterInfo { RuntimeVersion = "8.3.x-scala2.12", AzureAttributes = new AzureAttributes { Availability = AzureAvailability.ON_DEMAND_AZURE, FirstOnDemand = 1, SpotBidMaxPrice = -1 }, NodeTypeId = "Standard_DS3_v2", SparkEnvironmentVariables = new Dictionary <string, string> { ["PYSPARK_PYTHON"] = "/databricks/python3/bin/python3" }, EnableElasticDisk = true, NumberOfWorkers = 8 }, MaxConcurrentRuns = 10, NotebookTask = new NotebookTask { NotebookPath = "/Arcus - Automation" } }; return(settings); }
public async Task <IActionResult> Edit(int id, [Bind("Id,JobId,JobTitle,Company,vacancy,TopSkills,MinorSkills")] JobSettings jobSettings) { if (id != jobSettings.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(jobSettings); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JobSettingsExists(jobSettings.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(jobSettings)); }
protected override void OnShutdown() { TimeSpan maxTimeout = TimeSpan.MinValue; var waitHandles = new List <WaitHandle>(); foreach (TriggeredJobRunner triggeredJobRunner in _triggeredJobRunners.Values) { WaitHandle waitHandle = triggeredJobRunner.CurrentRunningJobWaitHandle; if (waitHandle != null) { waitHandles.Add(waitHandle); // Determine the maximum timeout for all currently running jobs JobSettings jobSettings = GetJobSettings(triggeredJobRunner.JobName); // By default wait for 30 seconds until the triggered WebJob is done TimeSpan stoppingWaitTime = jobSettings.GetStoppingWaitTime(DefaultTriggeredJobStoppingWaitTimeInSeconds); maxTimeout = stoppingWaitTime > maxTimeout ? stoppingWaitTime : maxTimeout; } } // Wait until all running jobs are finished up to the maximum timeout if (waitHandles.Any()) { WaitHandle.WaitAll(waitHandles.ToArray(), maxTimeout); } }
public virtual async Task Manage(JobSettings jobSettings) { await Task.Run(() => { var monitoringApi = JobStorage .Current .GetMonitoringApi(); var queues = monitoringApi .Queues(); var queueCount = monitoringApi .EnqueuedCount(jobSettings.QueueIdentifier); if (queueCount > 1) { var enqueuedJobIds = monitoringApi .EnqueuedJobs(jobSettings.QueueIdentifier, 0, int.MaxValue) .Select(j => j.Key); foreach (var jobId in enqueuedJobIds) { BackgroundJob .Delete(jobId); } } }); }
public void InvokeTriggeredJob(string jobName, string arguments, string trigger) { TriggeredJob triggeredJob = GetJob(jobName); if (triggeredJob == null) { throw new JobNotFoundException(); } triggeredJob.CommandArguments = arguments; if (IsShuttingdown) { throw new WebJobsStoppedException(); } TriggeredJobRunner triggeredJobRunner = _triggeredJobRunners.GetOrAdd( jobName, _ => new TriggeredJobRunner(triggeredJob.Name, Environment, Settings, TraceFactory, Analytics)); JobSettings jobSettings = triggeredJob.Settings; triggeredJobRunner.StartJobRun(triggeredJob, jobSettings, trigger, ReportTriggeredJobFinished); ClearJobListCache(); }
public List <T> ImportFromFileToMemory <T>(string path, IErrorHandler errorHandler = null) { JobSettings settings = new JobSettings { Tables = new List <Table>(), AuditColumns = new JobSettings.AuditSettings(), IgnoreAuditColumnsOnExport = true, UseAuditColumnsOnImport = false, Path = Path.GetDirectoryName(path) }; errorHandler = errorHandler ?? new DefaultErrorHandler(); Table table = new Table(); table.Name = typeof(T).Name; table.Initialize <T>(settings, errorHandler); var diffGenerator = new DiffGenerator(); using (var target = new EmptyDataReader(table)) using (var source = new XmlRecordDataReader(path, table)) using (var writer = new InMemoryDataWriter <T>(table)) { diffGenerator.GenerateDifference(source, target, table, writer, settings); return(writer.Data); } }
static void Main(string[] args) { PrintHeader(); JobSettings = new JobSettings(); CrmRecordCounter = new CrmRecordCounter(JobSettings); if (args.Length != 0) { var rawExpectedCount = args[0]; expectedCount = int.Parse(rawExpectedCount); } System.Console.WriteLine(ExitMessage); var bg = InitializeBackgroundWorker(); expectedCount = (int)MessagesCountInSB(); currentCount = expectedCount; ConsoleHelper.Log($"Messages dans le service bus : {expectedCount}"); ConsoleHelper.DrawTextProgressBar(ProgressMessage, 0, expectedCount); bg.RunWorkerAsync(); System.Console.ReadKey(true); System.Console.WriteLine(); bg.CancelAsync(); ConsoleHelper.Log(CoreCountStoppedMessage, ConsoleHelper.LogStatus.Warning); System.Console.ReadKey(); }
public void StopJob(bool isShutdown = false) { Interlocked.Exchange(ref _started, 0); bool logStopped = false; if (_continuousJobThread != null) { logStopped = true; if (isShutdown) { _continuousJobLogger.LogInformation("WebJob is stopping due to website shutting down"); } _continuousJobLogger.ReportStatus(ContinuousJobStatus.Stopping); NotifyShutdownJob(); // By default give the continuous job 5 seconds before killing it (after notifying the continuous job) if (!_continuousJobThread.Join(JobSettings.GetStoppingWaitTime(DefaultContinuousJobStoppingWaitTimeInSeconds))) { _continuousJobThread.Abort(); } _continuousJobThread = null; } SafeKillAllRunningJobInstances(_continuousJobLogger); if (logStopped) { UpdateStatusIfChanged(ContinuousJobStatus.Stopped); } }
public JobSettingsProvider(IConfiguration configuration) { var settings = configuration.GetSection(JobSettingKey); var jobSettings = JsonConvert.DeserializeObject <JobSettings>(settings.Value); _jobSettings = jobSettings; }
public void PerformGoal(ref NPC.NPCBase.NPCState state) { StoredItem[] remaining = new StoredItem[0]; state.JobIsDone = true; state.SetCooldown(_waitTime); if (remaining != null && remaining.Length != 0) { state.SetIndicator(new Shared.IndicatorState(_waitTime, remaining.FirstOrDefault().Id.Name, true, false)); } if (WalkingTo == StorageType.Crate) { if (StorageFactory.CrateLocations[Job.Owner].TryGetValue(CurrentCratePosition, out CrateInventory ci)) { remaining = ci.TryTake(ItemsToGet).Values.ToArray(); } } else { remaining = StorageFactory.TryTakeItemsReturnRemaining(Job.Owner, ItemsToGet); LastCratePosition.Clear(); WalkingTo = StorageType.Crate; } if (remaining.Length != 0) { ItemsToGet = remaining; LastCratePosition.Add(CurrentCratePosition); } else { JobSettings.SetGoal(Job, NextGoal, ref state); } }
public virtual void PerformGoal(ref NPC.NPCBase.NPCState state) { StoredItem[] remaining = new StoredItem[0]; state.SetCooldown(4); state.SetIndicator(new Shared.IndicatorState(_waitTime, ItemsToStore.FirstOrDefault().Id.Name, true, false)); if (WalkingTo == StorageType.Crate) { if (StorageFactory.CrateLocations[Job.Owner].TryGetValue(CurrentCratePosition, out CrateInventory ci)) { remaining = ci.TryAdd(ItemsToStore).ToArray(); } } else { StorageFactory.StoreItems(Job.Owner, ItemsToStore); } if (remaining.Length > 0) { ItemsToStore = remaining; LastCratePosition.Add(CurrentCratePosition); } else { JobSettings.SetGoal(Job, NextGoal, ref state); } }
public ScheduledJobServiceBase( IAsyncScheduledJob asyncScheduledJob, JobSettings jobSettings) { _asyncScheduledJob = asyncScheduledJob; _jobSettings = jobSettings; }
public virtual void OnEntry() { dynamic settingService = Activator.CreateInstance("Spark.DataAccess", "Spark.DataAccess.JobSettingsService").Unwrap(); _setting = settingService.GetLastByKey(Key); Parameter = _setting?.Parameter.ToDictionary(_ => _.Key, _ => _.Value); }
public void InPlaceJobRunsInPlace() { RunScenario("InPlaceJobRunsInPlace", appManager => { const string jobName = "joba"; var expectedTempStr = appManager.ServiceUrl.Contains("localhost") ? $@"Temp\{appManager.ApplicationName}\jobs\triggered\{jobName}" : $@"Temp\jobs\triggered\{jobName}"; var expectedAppDataStr = $@"App_Data\jobs\triggered\{jobName}"; TestTracer.Trace("Create the triggered WebJob"); appManager.JobsManager.CreateTriggeredJobAsync(jobName, "run.cmd", "cd\n").Wait(); TestTracer.Trace("Trigger the triggered WebJob"); VerifyTriggeredJobTriggers(appManager, jobName, 1, "Success", expectedTempStr); var jobSettings = new JobSettings(); TestTracer.Trace("Set triggered WebJob to is_in_place true"); jobSettings.SetSetting("is_in_place", true); appManager.JobsManager.SetTriggeredJobSettingsAsync(jobName, jobSettings).Wait(); TestTracer.Trace("Trigger the triggered WebJob"); VerifyTriggeredJobTriggers(appManager, jobName, 2, "Success", expectedAppDataStr); TestTracer.Trace("Set triggered WebJob to is_in_place false"); jobSettings.SetSetting("is_in_place", false); appManager.JobsManager.SetTriggeredJobSettingsAsync(jobName, jobSettings).Wait(); TestTracer.Trace("Trigger the triggered WebJob"); VerifyTriggeredJobTriggers(appManager, jobName, 3, "Success", expectedTempStr); TestTracer.Trace("Create the continuous WebJob"); appManager.JobsManager.CreateContinuousJobAsync(jobName, "run.cmd", "cd > %WEBROOT_PATH%\\..\\..\\LogFiles\\verification.txt.%WEBSITE_INSTANCE_ID%\n").Wait(); WaitUntilAssertVerified( "verification file", TimeSpan.FromSeconds(30), () => VerifyVerificationFile(appManager, new[] { expectedTempStr })); TestTracer.Trace("Set continuous WebJob to is_in_place true"); jobSettings.SetSetting("is_in_place", true); appManager.JobsManager.SetContinuousJobSettingsAsync(jobName, jobSettings).Wait(); WaitUntilAssertVerified( "verification file", TimeSpan.FromSeconds(30), () => VerifyVerificationFile(appManager, new[] { expectedAppDataStr })); TestTracer.Trace("Set continuous WebJob to is_in_place false"); jobSettings.SetSetting("is_in_place", false); appManager.JobsManager.SetContinuousJobSettingsAsync(jobName, jobSettings).Wait(); WaitUntilAssertVerified( "verification file", TimeSpan.FromSeconds(30), () => VerifyVerificationFile(appManager, new[] { expectedTempStr })); }); }
// public void Update(Vector3 target, JobSettings jobSettings, AnimationScriptPlayable playable) { var job = playable.GetJobData <CameraNoiseJob>(); job.target = target; job.jobSettings = jobSettings; playable.SetJobData(job); }
// public bool Setup(Animator animator, EditorSettings editorSettings) { jobSettings = editorSettings.jobSettings; m_CameraHandle = animator.BindStreamTransform(editorSettings.cameraBone); m_CharacterRoot = animator.BindStreamTransform(editorSettings.characterRootBone); return(true); }
/// <summary> /// Form Load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_Load(object sender, EventArgs e) { JobSettings = new JobSettings(); CrmRecordCounter = new CrmRecordCounter(JobSettings); bgWorkerCrmCounter.RunWorkerAsync(); bgWorkerServiceBus.RunWorkerAsync(); }
public ApplicationController(ApplicationDbContext db, UserManager <ApplicationUser> userManager, IOptions <JobSettings> jobSettings) { _db = db; _userManager = userManager; _jobSettings = jobSettings.Value; }
public void StartJobRun(TriggeredJob triggeredJob, JobSettings jobSettings, string trigger, Action <string, string> reportAction) { JobSettings = jobSettings; if (Settings.IsWebJobsStopped()) { throw new WebJobsStoppedException(); } if (!_lockFile.Lock()) { throw new ConflictException(); } TriggeredJobRunLogger logger = TriggeredJobRunLogger.LogNewRun(triggeredJob, trigger, Environment, TraceFactory, Settings); Debug.Assert(logger != null); try { if (_currentRunningJobWaitHandle != null) { _currentRunningJobWaitHandle.Dispose(); _currentRunningJobWaitHandle = null; } _currentRunningJobWaitHandle = new ManualResetEvent(false); var tracer = TraceFactory.GetTracer(); var step = tracer.Step("Run {0} {1}", triggeredJob.JobType, triggeredJob.Name); ThreadPool.QueueUserWorkItem(_ => { try { InitializeJobInstance(triggeredJob, logger); RunJobInstance(triggeredJob, logger, logger.Id, trigger, tracer); } catch (Exception ex) { logger.LogError("WebJob run failed due to: " + ex); } finally { step.Dispose(); logger.ReportEndRun(); _lockFile.Release(); reportAction(triggeredJob.Name, logger.Id); _currentRunningJobWaitHandle.Set(); } }); } catch (Exception ex) { logger.LogError("Failed to start job due to: " + ex); _lockFile.Release(); throw; } }
public void SetAsGoal() { if (!Job.NPC.Inventory.Contains(GuardSettings.ShootItem)) { var items = GuardSettings.ShootItem.Select(i => new StoredItem(i.Type, i.Amount * 50)).ToArray(); var getitemsfromCrate = new GetItemsFromCrateGoal(Job, JobSettings, this, items); JobSettings.SetGoal(Job, getitemsfromCrate, ref Job.NPC.state); } }
public CustomJobProcessor() { InitializeOrganizationServiceManager(); var config = JobSettings.GetOptionalParameter <string>("DeletionConfig"); config = config.Replace('\'', '"'); BulkDeleteConfigurationData = JsonSerializer.Deserialize <BulkDeleteConfiguration>(config); }
static void ApplyGlobalSettings(JobSettings jobSettings, Settings globalSettings) { jobSettings.ConnectionString = jobSettings.ConnectionString ?? globalSettings.ConnectionString; jobSettings.MergeStrategy = jobSettings.MergeStrategy ?? globalSettings.MergeStrategy; jobSettings.IgnoreAuditColumnsOnExport = jobSettings.IgnoreAuditColumnsOnExport ?? globalSettings.IgnoreAuditColumnsOnExport; jobSettings.UseAuditColumnsOnImport = jobSettings.UseAuditColumnsOnImport ?? globalSettings.UseAuditColumnsOnImport; jobSettings.DisableConstraintsOnImport = jobSettings.DisableConstraintsOnImport ?? globalSettings.DisableConstraintsOnImport; jobSettings.AuditColumns = jobSettings.AuditColumns ?? globalSettings.AuditColumns; }
private void Button_Connect_Click(object sender, RoutedEventArgs e) { StringBuilder sb = new StringBuilder(1024); try { // read account settings, dump AccountSettings accountSettings = SampleHelpers.LoadAccountSettings(); sb.AppendLine("--- accountSettings ---"); sb.AppendLine(accountSettings.ToString()); // read job settings, dump JobSettings jobSettings = SampleHelpers.LoadJobSettings(); sb.AppendLine("--- jobSettings ---"); sb.AppendLine(jobSettings.ToString()); // connect to batch, dump status BatchSharedKeyCredentials cred = new BatchSharedKeyCredentials( accountSettings.BatchServiceUrl, accountSettings.BatchAccountName, accountSettings.BatchAccountKey ); sb.AppendLine($"credentials created: {cred.AccountName},{cred.BaseUrl}"); using (BatchClient client = BatchClient.Open(cred)) { sb.AppendLine($"batchclient opened successfully"); // enumerate pools sb.AppendLine("--- pools ---"); foreach (var pool in client.PoolOperations.ListPools()) { sb.AppendLine($"pool found: id:{pool.Id} vmsize:{pool.VirtualMachineSize} state:{pool.State.ToString()}"); } sb.AppendLine("--- applications ---"); foreach (var app in client.ApplicationOperations.ListApplicationSummaries()) { sb.AppendLine($"application found: {app.Id} {app.Versions[0]}"); } } // batchclient } catch (AggregateException ae) { sb.AppendLine("aggregate exception caught"); sb.AppendLine(SampleHelpers.AggregateExceptionDump(ae.Flatten())); System.Diagnostics.Trace.Write(sb.ToString(), "ERROR"); } catch (Exception ex) { sb.AppendLine("exception caught"); sb.AppendLine(ex.ToString()); System.Diagnostics.Trace.Write(sb.ToString(), "ERROR"); } TextBlock_Out.Text = sb.ToString(); }
public void SubmitJobTest() { JobSettings jobSettings = new JobSettings(JobSettings.EngineEnum.BASIC); var response = instance.SubmitJob(jobid, jobSettings); Assert.IsInstanceOf <Job>(response, "response is Job"); Assert.NotNull(response); Assert.AreEqual(Job.StateEnum.PROCESSING, response.State); }
private static async Task AddEmby(JobSettings s) { await OmbiQuartz.Instance.AddJob <IEmbyContentSync>(nameof(IEmbyContentSync), "Emby", JobSettingsHelper.EmbyContent(s)); await OmbiQuartz.Instance.AddJob <IEmbyEpisodeSync>(nameof(IEmbyEpisodeSync), "Emby", null); await OmbiQuartz.Instance.AddJob <IEmbyAvaliabilityChecker>(nameof(IEmbyAvaliabilityChecker), "Emby", null); await OmbiQuartz.Instance.AddJob <IEmbyUserImporter>(nameof(IEmbyUserImporter), "Emby", JobSettingsHelper.UserImporter(s)); }
public void SubmitJobTest() { JobSettings jobSettings = new JobSettings(JobSettings.TfidfSchemeEnum.TFIDF, JobSettings.EngineEnum.BASIC, JobSettings.NormalizationEnum.COSINE, 0, 10); var response = instance.SubmitJob(jobid, jobSettings); Assert.IsInstanceOf <Job>(response, "response is Job"); Assert.NotNull(response); Assert.AreEqual(Job.StateEnum.PROCESSING, response.State); }
private static async Task AddJellyfin(JobSettings s) { await OmbiQuartz.Instance.AddJob <IJellyfinContentSync>(nameof(IJellyfinContentSync), "Jellyfin", JobSettingsHelper.JellyfinContent(s)); await OmbiQuartz.Instance.AddJob <IJellyfinEpisodeSync>(nameof(IJellyfinEpisodeSync), "Jellyfin", null); await OmbiQuartz.Instance.AddJob <IJellyfinAvaliabilityChecker>(nameof(IJellyfinAvaliabilityChecker), "Jellyfin", null); await OmbiQuartz.Instance.AddJob <IJellyfinUserImporter>(nameof(IJellyfinUserImporter), "Jellyfin", JobSettingsHelper.UserImporter(s)); }
public override void ResetForNewJob(JobSettings job) { SceneSettings jobScene = job as SceneSettings; if (jobScene == null) throw new Exception("Must set SceneSettings to " + this.GetType().Name); init(); ImageWidth = jobScene.ImageWidth; ImageHeight = jobScene.ImageHeight; }
public abstract void SetJob(JobSettings job);
private void runJob(JobSettings serverJobSettings) { try { onJobStarted(); this._worker.SetJob(serverJobSettings); Task task; try { task = _lucidServer.GetNextTask(); } catch (CommunicationException) { return; } while (task != null && Connected) { Inv.Log.Log.WriteMessage("Starting task " + task.Number); _worker.RunTask(task); //Inv.Log.Log.WriteMessage("Uploading task " + task.Number); try { lock (this) { // we could have been disconnected by the main thread if (_lucidServer != null) { _lucidServer.UploadResults(task); task = _lucidServer.GetNextTask(); } } } catch (CommunicationException) { // happens when new job started or server quit // during computation return; } } } catch { if (_lucidServer != null) { Disconnect(); } } }
/// <summary> /// Reset to initial state. /// </summary> public abstract void ResetForNewJob(JobSettings job);
public void CreateAndDeleteJobSucceeds() { RunScenario("CreateAndDeleteJobSucceeds", appManager => { string zippedJobBinaries = BuildZippedJobBinaries(); appManager.JobsManager.CreateTriggeredJobAsync("job1", zippedJobBinaries).Wait(); appManager.JobsManager.CreateTriggeredJobAsync("job2", zippedJobBinaries).Wait(); appManager.JobsManager.CreateContinuousJobAsync("job1", zippedJobBinaries).Wait(); appManager.JobsManager.CreateContinuousJobAsync("job2", zippedJobBinaries).Wait(); // Disabling a continuous job should not affect the job count WaitUntilAssertVerified( "disable continuous job", TimeSpan.FromSeconds(60), () => appManager.JobsManager.DisableContinuousJobAsync("job1").Wait()); // Adding a setting to a triggered job should not affect the job count var jobSettings = new JobSettings(); jobSettings["one"] = 1; appManager.JobsManager.SetTriggeredJobSettingsAsync("job1", jobSettings).Wait(); var triggeredJobs = appManager.JobsManager.ListTriggeredJobsAsync().Result; var continuousJobs = appManager.JobsManager.ListContinuousJobsAsync().Result; Assert.Equal(2, triggeredJobs.Count()); Assert.Equal(2, continuousJobs.Count()); VerifyTriggeredJobTriggers(appManager, "job1", 1, "Success", "echo "); appManager.JobsManager.DeleteTriggeredJobAsync("job1").Wait(); appManager.JobsManager.DeleteTriggeredJobAsync("job2").Wait(); appManager.JobsManager.DeleteContinuousJobAsync("job1").Wait(); appManager.JobsManager.DeleteContinuousJobAsync("job2").Wait(); triggeredJobs = appManager.JobsManager.ListTriggeredJobsAsync().Result; continuousJobs = appManager.JobsManager.ListContinuousJobsAsync().Result; Assert.Equal(0, triggeredJobs.Count()); Assert.Equal(0, continuousJobs.Count()); }); }
public void StartNewJob(JobSettings job) { this.jobSettings = job; this.workerMaster.ResetForNewJob(job); }
public void InPlaceJobRunsInPlace() { RunScenario("InPlaceJobRunsInPlace", appManager => { const string jobName = "joba"; const string expectedTempStr = "Temp\\jobs\\triggered\\" + jobName; const string expectedAppDataStr = "App_Data\\jobs\\triggered\\" + jobName; TestTracer.Trace("Create the triggered WebJob"); appManager.JobsManager.CreateTriggeredJobAsync(jobName, "run.cmd", "cd\n").Wait(); TestTracer.Trace("Trigger the triggered WebJob"); VerifyTriggeredJobTriggers(appManager, jobName, 1, "Success", expectedTempStr); var jobSettings = new JobSettings(); TestTracer.Trace("Set triggered WebJob to is_in_place true"); jobSettings.SetSetting("is_in_place", true); appManager.JobsManager.SetTriggeredJobSettingsAsync(jobName, jobSettings).Wait(); TestTracer.Trace("Trigger the triggered WebJob"); VerifyTriggeredJobTriggers(appManager, jobName, 2, "Success", expectedAppDataStr); TestTracer.Trace("Set triggered WebJob to is_in_place false"); jobSettings.SetSetting("is_in_place", false); appManager.JobsManager.SetTriggeredJobSettingsAsync(jobName, jobSettings).Wait(); TestTracer.Trace("Trigger the triggered WebJob"); VerifyTriggeredJobTriggers(appManager, jobName, 3, "Success", expectedTempStr); TestTracer.Trace("Create the continuous WebJob"); appManager.JobsManager.CreateContinuousJobAsync(jobName, "run.cmd", "cd > %WEBROOT_PATH%\\..\\..\\LogFiles\\verification.txt.%WEBSITE_INSTANCE_ID%\n").Wait(); WaitUntilAssertVerified( "verification file", TimeSpan.FromSeconds(30), () => VerifyVerificationFile(appManager, new[] { expectedTempStr })); TestTracer.Trace("Set continuous WebJob to is_in_place true"); jobSettings.SetSetting("is_in_place", true); appManager.JobsManager.SetContinuousJobSettingsAsync(jobName, jobSettings).Wait(); WaitUntilAssertVerified( "verification file", TimeSpan.FromSeconds(30), () => VerifyVerificationFile(appManager, new[] { expectedAppDataStr })); TestTracer.Trace("Set continuous WebJob to is_in_place false"); jobSettings.SetSetting("is_in_place", false); appManager.JobsManager.SetContinuousJobSettingsAsync(jobName, jobSettings).Wait(); WaitUntilAssertVerified( "verification file", TimeSpan.FromSeconds(30), () => VerifyVerificationFile(appManager, new[] { expectedTempStr })); }); }
public async Task SetTriggeredJobSettingsAsync(string jobName, JobSettings jobSettings) { await Client.PutJsonAsync<JobSettings, object>("triggered/" + jobName + "/settings", jobSettings); }
public async Task SetContinuousJobSettingsAsync(string jobName, JobSettings jobSettings) { await Client.PutJsonAsync<JobSettings, object>("continuous/" + jobName + "/settings", jobSettings); }