timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-44284] Jenkins concurrent builds not working when triggered simultaneously #9149

Open timja opened 7 years ago

timja commented 7 years ago

Hi Team,

Facing problem while trying to trigger concurrent executions of a job via Jenkins API.

Have configured a job to run builds concurrently.

It works fine when the jobs are triggered after a few minutes. Execute first job run, let it get started and then start the second job run. Both the first and second jobs run concurrently now and we get separate build ids for each job run.

However, when we try to execute job concurrently at the same time it just triggers one execution of the job and returns its build id.

Have tested it with both the python-jenkins wrapper and Jenkins python REST API. Please find both the scripts attached.

Suspect the queue does not take more then one instance of the job at a given time. Can only see one instance of my job on the queue when we trigger simultaneous invocation.

Tried to change the build parameters as well but still face the same problem.

Can someone please help.

Regards,

Narendra Patel


Originally reported by narendrapatel, imported from: Jenkins concurrent builds not working when triggered simultaneously
  • status: Open
  • priority: Critical
  • resolution: Unresolved
  • imported: 2022/01/10
timja commented 7 years ago

oleg_nenashev:

Please check parameters you pass to the job. If the parameters are same, Jenkins Queue merges pending tasks

timja commented 7 years ago

narendrapatel:

Hi Oleg,

Have tried it with different parameters as well. Same issue.

By parameters i mean the values to the parameters, the count/name of parameters is the same.

You can also have a look at the attached scripts that we are using.
python-jenkins would require pip install of python-jenkins.
jenkins_rest_api.py should only require Python 2.7

Regards,

Narendra Patel

timja commented 7 years ago

oleg_nenashev:

If the parameters are same, it works as expected. Please provide the job's config.xml just in case there is something inside.

timja commented 7 years ago

narendrapatel:

Hi Oleg,

Please find the config.xml attached to the case.

Thank you for helping us out here!!

Regards,

Narendra Patel

timja commented 7 years ago

narendrapatel:

Hi Oleg,

Did you got a chance to have a look at the configuration file.

timja commented 7 years ago

narendrapatel:

Hi Oleg,

Have implemented a workaround for time being.

Before building a job my code polls the jenkins queue and checks if a previous build/instance of the current job is already in queue. If yes, then it waits for a pre-configured amount of time and periodically polls, in this time interval, the queue again to check if the job is sent of execution and is no more in the queue. If yes, then it initiates my new build else it timeouts and raises my custom exception.

Regards,

Narendra Patel

timja commented 5 years ago

pezinek:

Same problem here, however it seems to help if the build job is submitted with quietPeriod: 0