Bidirectional Program Schedule Links

Checklist

  • User Stories Documented
  • User Stories Reviewed
  • Design Reviewed
  • APIs reviewed
  • Release priorities assigned
  • Test cases reviewed

Introduction 

A design to store and retrieve the information of what programs can trigger a schedule to launch a given program, and also what programs are triggered by a given program.

Goals

Storing the information of what programs can trigger the given program should make minimum change to the current Schedule Store implementation. Retrieving the bidirectional links should be fast and the results can be easily used by UI.

User Stories 

  • A user wants to know what pipelines will trigger schedules to launch the current pipeline
  • A user wants to know what other pipelines will be triggered by the current pipeline

Design

A new index of programs and schedules triggered by them in Schedule Store is needed. REST API's will be used to retrieve the information of triggering programs of a given program or triggered programs of a given program.

Approach

No change of the Schedule Store is needed for storing what programs can trigger a given workflow or pipeline, because the Schedule Store already indexes schedules by trigger keys, which is just the triggering program's ProgramId in the case of program status trigger, the trigger key. To retrieve the programs triggering schedules to launch a workflow, the existing REST API:

GET /v3/namespaces/<namespace-id>/apps/<app-id>/workflows/<workflow-id>/schedules

can be called to get all schedules that can launch the given workflow and the front end can filter out the program status schedules. A query parameter <trigger-type> will be added to filter schedules by the trigger type.

 To store what programs are triggered by the current workflow, Schedule Store needs to index the triggering workflow's ProgramId's. An new REST API also needs to be added to retrieve the schedules containing program status trigger of a given program.

PathMethodDescriptionResponse CodeResponse
/v3/namespaces/<namespace-id>/apps/<app-id>/workflows/<workflow-id>/schedules?trigger-type=<type>GET

An optional new REST API to retrieve schedules with a given trigger type that can launch a given workflow:

200 - On success

404 - When application is not available

500 - Any internal errors

A list of schedules containing a given trigger type that can launch the given workflow

/v3/namespaces/<namespace-id>/schedules/trigger-type/<type>/?[&program-id=<program-id>&status=<program-status>]GET

New REST API to retrieve schedules that are triggered by a certain trigger type with optional query parameters. For instance, if the trigger type is program-status, then query parameter can be the programId and optionally a program status.

200 - On success

404 - When application is not available

500 - Any internal errors

A list of schedules with matching triggers

UI Impact or Changes

  • Need to display what pipelines are triggered by the current pipeline with what condition and what pipelines with what condition can trigger the current pipeline

Test Scenarios

Test IDTest DescriptionExpected Results
1List all schedules with ProgramStatusTrigger that can launch a given workflowAll schedules with ProgramStatusTrigger that can launch a given workflow will be returned
2Delete some schedules returned in test 1, and query for the schedules with ProgramStatusTrigger that can launch the same workflow againOnly schedules not deleted should be returned
3List all schedules triggered by a given workflowAll schedules triggered by a given workflow should be returned
4Delete some schedules returned in test 3, and query for the schedules triggered by the same workflow againOnly schedules not deleted should be returned

Releases

Related Work

  • ProgramStatusTrigger