I know how to run a bash script on Jenkins. However, if I use qsub to submit the bash script to OGE system, how does Jenkins know that my job terminates or not?
3 Answers
You can use "-sync y" on your qsub to cause the qsub to wait until the job(s) are finished.

- 849
- 4
- 11
-
I checked all options supported by qsub but cannot find "-sync y". – Leo5188 Nov 11 '11 at 04:10
-
What version of SGE/OGE do you have? Try "qsub -help". Mine is 6.2u4 and qsub -help lists this option: "[-sync y[es]|n[o]] wait for job to end and return exit code". – jlp Nov 27 '11 at 06:41
Jenkins allows for you to submit the results of a build using a web based API. I currently use this to monitor a job remotely for a grid at my orginization. If you have the ability to perform a web post to the jenkins server you could use the below script to accomplish the job.
#!/bin/bash
MESSAGE="Some message about job success"
RUNTIME="Some calculation to estimate runtime"
USERNAME="userNameForJenkinsLogin"
PASSWORD="passwordForJenkinsLogin"
JENKINS_HOST="URLToJenkins"
TEST_NAME="Name of Test"
curl -i -X post -d "<run><log>$MESSAGE</log><result>0</result><duration>$RUNTIME</duration></run>" http://$USERNAME:$PASSWORD@$JENKINS_HOST/jenkins/job/$TEST_NAME/postBuildResult

- 1,221
- 8
- 14
The Jenkins SGE Cloud plugin submits builds to the Sun Grid Engine (SGE) batch scheduler. Both the open source version of SGE and the commercial Univa Grid Engine (UGE) are supported.
This plugin adds a new type of build step Run job on SGE that submits batch jobs to SGE. The build step monitors the job status and periodically appends the progress to the build's Console Output. Should the build fail, errors and the exit status of the job also appear. If the job is terminated in Jenkins, it is also terminated in SGE.
Builds are submitted to SGE by a new type of cloud, SGE Cloud. The cloud is given a label like any other slave. When a job with a matching label is run, SGE Cloud submits the build to SGE.

- 9,117
- 9
- 42
- 50
-
1While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/10762684) – worldofjr Jan 04 '16 at 02:12
-
I added details about what the plugin does, and updated the link to the Jenkins wiki, which can be expected to be stable. – John McGehee Mar 31 '16 at 21:17