SLURM and consecutive jobs - submit

I tried to set up consecutive jobs using SLURM but failed.
At the end of the current job, I successfully create the folder and input files for the next job. I can also go to that folder, but when I submit it immediately stop. The job gets submitted but then nothing happen, it just stop without any error message.
Here is how I proceed:
cp CONFIG.OUT ../$NEXT_DIR/CONFIG.INI
cd ../$NEXT_DIR
pwd
sbatch run.npt
Does anyone know how to submit a SLURM job from a SLURM script?
I've no problem doing this with LSF.
Thank you,
Eric.

Thanks Pankrates,
yes it does.
I figured out, I just of to use the array feature of slurm.
Thank you.

Related

How to interactively pass values between Ansible and Jenkins while the Job is Running

My Jenkins UI takes parameter a list of files/folders along with wildcards from users that they wish to delete.
Jenkins then passes the files to be deleted across all hosts by invoking ansible-playbook.
My requirement is to prompt user on Jenkins for confirmation before deleting a file / folder.
Thus, how rm -rfi /tmp/moht /var/log*/data.dat prompts interactively asking the user confirmation before deleting the files; is what I Wish to prompt on Jenkins for each Host.
Thus, for the above I expect Jenkins to prompt like below:
Are you sure you want to delete
/tmp/moht
/var/log14Mar/data.dat
I'm aware of input function in Jenkins for prompt.
I'm also aware of an ansible command module that can be used to fire rm -rfi command.
I'm also aware of how to timeout or terminate the Jenkins Job upon user input. However, in this case I would love if the user input Yes / No could be sent back to the target host via ansible and action gets performed accordingly.
I understand that this may be too much an ask but other feasible solutions or suggestions are also appreciated.
Can you please suggest how can I achieve the requirement?
I strongly feel that using Jenkins as interactive tool is a bad idea. But if you really like to implement bad ideas with unsuitable tools, you can try to use matrix job [1] based on files you want to remove.
Jenkins will create a list of jobs with a job for each file you'd like to remove. You ask confirmation and then execute an Ansible playbook to remove a file.
[1] https://plugins.jenkins.io/matrix-project/
It's horribly inefficient and you should not do it like this.

Jenkins build waiting for next available executor pending time

I need to get the exact time when the build has triggered(build periodically option currently using). Because of the configuration only 3 tasks can run in parallel. Consider 3 tasks are running in parallel now. So the executor will be putting the next task in Waiting for the next available Executor state. So I need to access this waiting time or exactly when it is started as date means when its triggered.
I have used Build Timestamp Plugin also. But no use. It is giving the time when the build steps has started. So can anybody help me do this? Thanks.
I have found one solution which I'm going to share now. If anybody is in the same situation, this might help them.
build_details = get('http://localhost:8080/jenkins/job/<jobName>/api/xml?tree=builds[id,queueId]&xpath=//build[id=<buildId>]')
queueId = build_details['build']['queueId']
queue_details = get('http://localhost:8080/jenkins/queue/item/<queueId>/api/json')
job_queued_time = Time.at(queue_details['inQueueSince'] / 1000.0).to_time.utc
Note: I've posted pseudo code, not a full solution. You have to port it to your language. <jobName>, <buildId>, <queueId> are variables, please replace them.
Here, localhost:8080 is same for everyone because, that is going to run in Jenkins machine itself. Mostly my solution works for single node Jenkins(i.e. No master-slave architecture). I haven't tested it in master-slave though.

what jenkins can do other than build?

I have some processes or I can call them as events and after completion of that processes or events I wanted to kick start the backup processes. Is it possible with jenkins? if yes then how to do it? if not what is other the solution.
Thanks.
I would recommend the Jenkins Multi-Job Plugin
This plugin allows you to define conditional steps which only run when the previous step was successful. I use this plugin heavily and highly recommend it to anyone looking to use Jenkins to automate a multi-step process.
https://wiki.jenkins-ci.org/display/JENKINS/thinBackup
You can use this thin backup plugin also.
You have two options :
Write a post build action to get the backup. For this you can use shell script to where how and what kind of backup you want.
Create another job which is responsible for backup. you can trigger that job after successful completion of all your events.

Modify notifications on a running build in jenkins

I occasionally want to get notified when a particular jenkins job that is building finishes. Is there any way to do this?
Scripting it through the API would be fine. I already have the jenkins IRC bot that notifies me of many things, so if I could just dynamically modify the running job build, that would be enough to do what I want -- I'm just having a hard time finding how to accomplish that.
AFAIK, you cannot change a job's config while it's running.
Here is an idea: Use a post-build step to check for an external resource status (like a file containing an action by text) and running an action based on the content of the file.
The external file can be modified while the build is running, so when the post-build is executed, it will follow the logic defined based on the content of the file.
I hope this helps.
You can use email notifier, It will send you an email
https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin

Jenkins execute shell how to get the user who run the job

I want sned a message to the executer,when the job tigger and complete. But the first question is how to get the user who run the job.
I look at the list of available environment variables. But I can't find the variables than I wanted.
I think this plugin can help you: Build User Vars Plugin
Take a look to the usage example. This will tell you how the configuration works.

Resources