jobs

Configuring Quartz.Net to stop a job from executing, if it is taking longer than specified time span

我只是一个虾纸丫 提交于 2019-12-19 22:01:06
问题 I am working on making a scheduler, just like Windows Scheduler using Quartz.Net. In Windows Scheduler, there is an option to stop a task from running if it takes more than the specified time. I have to implement the same in my scheduler. But I am not able to find any extension method/setting to configure Trigger or Job accordingly. I request some inputs or suggestions for it. 回答1: You can write small code to set a custom timout running on another thread. Implement IInterruptableJob interface

Read .txt file from workspace groovy script in Jenkins

こ雲淡風輕ζ 提交于 2019-12-19 05:07:05
问题 I am new to Jenkins and to groovy scripting, I want to read a .txt file which is located in the workspace of one of the jobs. I am trying to do this way: myfile = Jenkins.instance.getJob('JobName').workspace.readFileFromWorkspace('file.txt'); But leads to the following error: groovy.lang.MissingMethodException: No signature of method: hudson.FilePath.readFileFromWorkspace() is applicable for argument types: (java.lang.String) values: [file.txt] 回答1: Try this: file = new File("${Jenkins

How to get a handle to a JobObject without knowing its name?

依然范特西╮ 提交于 2019-12-19 04:35:20
问题 My application is running in a job. I want to get a Handle to this Jobobject using OpenJobObject so i can later use this handle. The problem is, that i don't know the jobs name, and with passing NULL to the Job name it gives error 87 ( The parameter is incorrect ) back. This is how i tried it: HANDLE handle = OpenJobObject( JOB_OBJECT_QUERY, FALSE, NULL ); if ( !handle ) printf( "\nError %d", GetLastError() ); else printf( "\nOK" ); I also found this on MSDN: An application cannot obtain a

How to get a handle to a JobObject without knowing its name?

扶醉桌前 提交于 2019-12-19 04:35:05
问题 My application is running in a job. I want to get a Handle to this Jobobject using OpenJobObject so i can later use this handle. The problem is, that i don't know the jobs name, and with passing NULL to the Job name it gives error 87 ( The parameter is incorrect ) back. This is how i tried it: HANDLE handle = OpenJobObject( JOB_OBJECT_QUERY, FALSE, NULL ); if ( !handle ) printf( "\nError %d", GetLastError() ); else printf( "\nOK" ); I also found this on MSDN: An application cannot obtain a

Kubernetes - how to run job only once

二次信任 提交于 2019-12-18 14:48:11
问题 I have a job definition based on example from kubernetes website. apiVersion: batch/v1 kind: Job metadata: name: pi-with-timeout-6 spec: activeDeadlineSeconds: 30 completions: 1 paralleism: 1 template: metadata: name: pi spec: containers: - name: pi image: perl command: ["exit", "1"] restartPolicy: Never I would like run this job once and not restart if fails. With comand exit 1 kubernetes trying to run new pod to get exit 0 code until reach activeDeadlineSeconds timeout. How can avoid that?

Powershell - how to pre-evaluate variables in a scriptblock for Start-Job

萝らか妹 提交于 2019-12-18 14:14:39
问题 I want to use background jobs in Powershell. How to make variables evaluated at the moment of ScriptBlock definition? $v1 = "123" $v2 = "asdf" $sb = { Write-Host "Values are: $v1, $v2" } $job = Start-Job -ScriptBlock $sb $job | Wait-Job | Receive-Job $job | Remove-Job I get printed empty values of $v1 and $v2. How can I have them evaluated in (passed to) the scriptblock and so to the background job? 回答1: One way is to use the [scriptblock]::create method to create the script block from an

Executing SQL Server Agent Job from a stored procedure and returning job result

丶灬走出姿态 提交于 2019-12-17 16:35:10
问题 Need to have a stored procedure that calls a SQL Server Agent Job and returns whether or not the job ran successfully or not. So far I have CREATE PROCEDURE MonthlyData AS EXEC msdb.dbo.sp_start_job N'MonthlyData' WAITFOR DELAY '000:04:00' EXEC msdb.dbo.sp_help_jobhistory @job_name = 'MonthlyData' GO Which starts the job, whats the best way to get back if the job ran successfully or not? Ok made an edit and used WAITFOR DELAY as the job normally runs between 3-4 mins never longer than 4. Does

Jenkins restrict view of jobs per user

家住魔仙堡 提交于 2019-12-17 10:25:12
问题 Is there a way to restrict user to view only certain jobs in Jenkins. Jenkins allows the restriction of user ability per project via the "Project-based Matrix Authorization Strategy". The problem is that a user can not access anything without the 'Overall' 'Read' setting. This seems to allow them to view all the jobs. Is there another plugin that would allow the job restriction? 回答1: Think this is, what you are searching for: Allow access to specific projects for Users Short description

【Linux】fg bg ctrl + z jobs & 等命令

橙三吉。 提交于 2019-12-16 18:49:32
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 【Linux】fg bg ctrl + z jobs & 等命令 转自: http://blog.chinaunix.net/space.php?uid=20697318&do=blog&id=1891382 fg、bg、jobs、&、ctrl + z都是跟系统任务有关的,虽然现在基本上不怎么需要用到这些命令,但学会了也是很实用的 一。& 最经常被用到 这个用在一个命令的最后,可以把这个命令放到后台执行 二。ctrl + z 可以将一个正在前台执行的命令放到后台,并且暂停 三。jobs 查看当前有多少在后台运行的命令 四。fg 将后台中的命令调至前台继续运行 如果后台中有多个命令,可以用 fg %jobnumber将选中的命令调出,%jobnumber是通过jobs命令查到的后台正在执行的命令的序号(不是pid) 五。bg 将一个在后台暂停的命令,变成继续执行 如果后台中有多个命令,可以用bg %jobnumber将选中的命令调出,%jobnumber是通过jobs命令查到的后台正在执行的命令的序号(不是pid) Linux下使用Shell命令控制任务Jobs执行 下列命令可以用来操纵进程任务:   ps 列出系统中正在运行的进程;   kill 发送信号给一个或多个进程(经常用来杀死一个进程);   jobs

Powershell Start-job invoke function argument with parameter

若如初见. 提交于 2019-12-14 03:07:14
问题 I have a function mainFunction that gets 2 parameters - $name will be just a regular string, and $moveFunction will be some function. I want to start a job of a ScriptBlock ( $SB ) that will invoke $moveFunction with $name as his argument. function foo($a){ Write-Output "In function foo with the argument => $a" } $SB = { param($C, $fooFunction) $fooFunction.Invoke($C) } function mainFunction($name, $moveFunction){ Start-Job -Name "currentJob" -ArgumentList $name, ${Function:$moveFunction}