Skip to content

Is there a way to prevent parallel jobs from getting triggered if they are dependent on the same resource #2071

Closed

Description

@SaurabhQA

Hi there!

JobA and JobB are parallel jobs in the pipeline which get triggered when there is a change in some resource. Other jobs in the pipeline are dependent on previous jobs. I donot want my pipeline to get triggered if any job in pipeline is in-progress. For that I am using pool lock which is working fine except for the parallel jobs. I wanted Job2 to be triggered only when Job1 starts running.

Is there a way to pause the resource check from the pipeline? Fly supports the pause resource similar functionality can we do inside the pipeline.

Below is the sample pipeline.

resources:

Activity

  1. shashwathi commented on Mar 19, 2018

    @shashwathi
    Contributor

    @SaurabhQA : Have you considered using serial_groups?

  2. SaurabhQA commented on Mar 27, 2018

    @SaurabhQA
    Author

    @shashwathi Thanks for the reply. I tried the below scenario. Job-A and Job-B are parallel jobs. Job-C and Job-D are executed when the previous job passed. I saw that when Job-C was is progress A and B was not triggered however once Job-C completed again Job-A and Job-B was triggered. I expected Job-D to be triggered after Job-C completed. Attached is the pipeline file.Could you please suggest how to serialize my pipeline. How can I prevent triggering of pipeline when previous Jobs are expected to run?
    serialTrigger.txt

    Job-A
    serial_groups: [serial-group-1]
    job-B
    serial_groups: [serial-group-2]
    Job-C
    serial_groups: [serial-group-1,serial-group-2]
    Job-D
    serial_groups: [serial-group-1,serial-group-2]

  3. shashwathi commented on Mar 28, 2018

    @shashwathi
    Contributor

    I saw that when Job-C was is progress A and B was not triggered however once Job-C completed again Job-A and Job-B was triggered

    It is possible that Job A and Job B are triggered because of new commit to flight-school resource. Job A and Job B have trigger: true set only on that resource.

    I expected Job-D to be triggered after Job-C completed.

    If there is a new commit on flight school which has passed Job C then Job D will be triggered. It is possible that the following sequence of events might have occured

    • Job A and Job B pass with commit 1234
    • Job C is triggered with flight school resource 1234
    • New commit is made to flight school with commit sha 1235
    • Job A and Job B is queued up(not running cuz of serial group)
    • Job A and Job B get triggered before Job D.

    How can I prevent triggering of pipeline when previous Jobs are expected to run?

    Consider merging Job C and Job D and use on-success to trigger task of Job D. Looks like you really want Job D to be triggered after C so merge them into one job definition and have 2nd task trigger only if previous one succeeds.

    Hope this helps

  4. self-assigned this
    on Mar 28, 2018
  5. SaurabhQA commented on Mar 29, 2018

    @SaurabhQA
    Author

    Thanks! It works 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions