-
Notifications
You must be signed in to change notification settings - Fork 61
Add PRECURSOR link type and clarify activity linking #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
e-backmark-ericsson
merged 12 commits into
eiffel-community:master
from
e-backmark-ericsson:issue227
Sep 21, 2022
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9f0dc8a
Add PRECURSOR link type and clarify activity linking
magnusbaeck 2538cd6
Update black pylib
e-backmark-ericsson 75f0cab
Updates to enable review
e-backmark-ericsson ef167b9
Added for TSS, updated graphs, solved question
e-backmark-ericsson 9bb3d5b
Apply suggestions from code review
e-backmark-ericsson 869a8c0
Updates for review comments
e-backmark-ericsson 4ccb689
Taking care of review comments
e-backmark-ericsson f81b0d7
Fixing some review comments
e-backmark-ericsson 2235357
Updates after review
e-backmark-ericsson 66fec7a
Fix minor review comments
e-backmark-ericsson 2b3c875
Fix minor review comments
e-backmark-ericsson 38d6b83
Minor review update
e-backmark-ericsson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| <!--- | ||
| Copyright 2022 Ericsson AB. | ||
| For a full list of individual contributors, please see the commit history. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| ---> | ||
|
|
||
| # Activity Linking | ||
| _Activity linking_ is the act of connecting [activities](./glossary.md#activity) within a [pipeline](./glossary.md#pipeline) to each other. It includes not just linking pipeline steps to each other, but also linking hierarchically, such as an overall pipeline activity, a set of sub activities for a build or a test, or linking multiple complete pipelines to each other. | ||
|
|
||
| Activity links are important both for tracing what activity/activities preceded a certain activity or what activity/activities followed after a certain activity, but also for tracing a full chain of parallel/serial activities within a pipeline. Tracing the activities in pipelines is the base for various kinds of pipeline visualizations and also for metrics and KPI measurements. | ||
|
|
||
| ## Event Driven vs Orchestrated Pipeline | ||
|
|
||
| Pipeline executors can have different mechanisms for choosing when its activities should be triggered. We find it useful to define the following extremes: | ||
|
|
||
| A _fully event driven pipeline_ in Eiffel terminology is a pipeline where _all_ activities in it are triggered explicitly by Eiffel events. Those events could either come from earlier pipeline steps, or from other pipelines producing for example artifacts that this pipeline would be configured to trigger on. | ||
|
|
||
| A _fully orchestrated pipeline_ is completely controlled by a dedicated pipeline orchestrator, such as Jenkins Pipeline or Argo Workflows, and has no activities triggered by Eiffel events. A fully orchestrated pipeline is probably often initiated by a source change in some SCM system, and that source change is then propagated to the pipeline orchestrator through some non-Eiffel-event channel (e.g. an Github web hook or a Gerrit stream-event) | ||
|
|
||
| None of the scenarios above is probably relevant for most of the Eiffel event users, but rather a combination of the two where a pipeline is often _triggered_ by an Eiffel event, and an orchestrator deals with controlling (at least parts of) the pipeline. Such triggers could for example be SCM events ([SCC][SCC]/[SCS][SCS]) or artifact events (e.g. [ArtC][ArtC]/[ArtP][ArtP]/[CLM][CLM]). | ||
|
|
||
| To handle the different possible scenarios for pipeline execution, multiple link types are defined in the Eiffel protocol. Those link types are used for linking between activity events. | ||
|
|
||
| ## Link Types Involved | ||
| This section describes the main link types involved in linking activities in pipelines | ||
|
|
||
| ### CAUSE | ||
| Identifies a cause of the event occurring, in the situations where the cause is an Eiffel event. This link type is not relevant only for EiffelActivity\*Events, but for any Eiffel event that represent an [occurrence](glossary.md#occurrence) that was caused by an earlier Eiffel event. | ||
|
|
||
| __Required:__ No | ||
| __Legal sources:__ Any | ||
| __Legal targets:__ Any | ||
| __Multiple allowed:__ Yes | ||
|
|
||
| ### PRECURSOR | ||
| This link type is used to declare *temporal relationships* between activities in a pipeline, i.e. what other activity/activities preceded this activity. | ||
|
|
||
| *The image below shows how an activity that precedes another activity is denoted by a PRECURSOR link from the second ActT event back to the first one.* | ||
|
|
||
e-backmark-ericsson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|  | ||
|
|
||
| An activity could have multiple PRECURSOR activities (also known as "fan-in"), which means that the activity was triggered in serial after a certain group of parallel activities were triggered. This can be used to declare merge points of a group of parallel activities into a succeeding activity. | ||
|
|
||
e-backmark-ericsson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| *The image below shows how three parallel activities are followed by one activity in serial. It is denoted by PRECURSOR links from the ActT event of the last activity to the ActT event of all preceding parallel activities.* | ||
|
|
||
|  | ||
|
|
||
| The fact that a certain activity is triggered, having some preceding activity/activities as PRECURSOR(s) does not in itself mean that the preceding activity/activities is/are finished before this activity was triggered. It merely means that it was triggered *after* that/those other activity/activities were triggered. | ||
|
|
||
| PRECURSOR links are only valid to be used on the triggering event of an activity, i.e. on EiffelActivityTriggeredEvent or on EiffelTestSuiteStartedEvent, and the target of this link type shall be an event of the same type. | ||
|
|
||
| This link type is relevant mostly to non event-triggered activities. It is though recommended to also use it for event-triggered activities, as it helps visualizing the full chain of activities in a pipeline in a common way regardless of how each activity was triggered. By always providing PRECURSOR links between activities, a visualization tool does not need to follow any CAUSE links in order to visualize the activity relationships. | ||
|
|
||
| For event links between two or more complete pipelines, e.g. when a source change in a repository is automatically created by an update to an upstream dependency for that repository, there would be a CAUSE link to the event notifying that updated dependency. The protocol currently does not recommend to use a PRECURSOR link in that scenario, as the PRECURSOR link type is intended to be used between events of the same type. | ||
|
|
||
| __Required:__ No | ||
| __Legal sources:__ [EiffelActivityTriggeredEvent][ActT], | ||
| [EiffelTestCaseTriggeredEvent][TCT], [EiffelTestSuiteStartedEvent][TSS] | ||
| __Legal targets:__ [EiffelActivityTriggeredEvent][ActT], | ||
| [EiffelTestCaseTriggeredEvent][TCT], [EiffelTestSuiteStartedEvent][TSS] | ||
| __Multiple allowed:__ Yes | ||
|
|
||
| ### CONTEXT | ||
| This link type is used to declare *hierarchies* of activities within a pipeline. The CONTEXT identifies the activity or test suite of which this event constitutes a part. For example: | ||
| - This *pipeline step* is executed in the *CONTEXT* of that *pipeline*, i.e. the pipeline step is part of a certain pipeline, and the ActT event of the pipeline step SHOULD have a CONTEXT link to the ActT event of the pipeline itself. | ||
| - This *test suite* is executed in the *CONTEXT* of that *pipeline step*, i.e. the test suite is executed within a certain pipeline step, and the TSS event for the test suite SHOULD then have a CONTEXT link to the ActT event of the pipeline step. | ||
| - This *artifact* was built within the *CONTEXT* of that *pipeline step*, i.e. the ArtC event SHOULD have a CONTEXT link to the ActT event of the pipeline step. | ||
|
|
||
| It is probably not relevant to provide a CONTEXT link to a test case execution, so therefore the Eiffel protocol does not allow [EiffelTestCaseTriggeredEvent][TCT] to be a legal target for this link type. | ||
|
|
||
| __Required:__ No | ||
| __Legal sources:__ Any | ||
| __Legal targets:__ [EiffelActivityTriggeredEvent][ActT], | ||
| [EiffelTestSuiteStartedEvent][TSS] | ||
| __Multiple allowed:__ No | ||
|
|
||
| ### FLOW_CONTEXT | ||
| This link type is not related to activity linking, but is mentioned here as it could be confused with the CONTEXT link type. A FLOW_CONTEXT link points at an [EiffelFlowContextDefinedEvent][FCD] which provides additional metadata about for example the program or track that the event is emitted for and thus doesn't describe relationships between activities. | ||
|
|
||
| __Required:__ No | ||
| __Legal sources:__ Any | ||
| __Legal targets:__ [EiffelFlowContextDefinedEvent][FCD] | ||
| __Multiple allowed:__ Yes | ||
|
|
||
| ## Why not use CAUSE instead of PRECURSOR? | ||
| The link type PRECURSOR is more recently added to the protocol than the CAUSE type, and the scenario described for the PRECURSOR type above was previously often described using CAUSE links instead. It is perfectly possible to create a fully traceable event graph using CAUSE links and not involving PRECURSOR links, but it has a number of drawbacks. For example: | ||
|
|
||
| - The semantics of a CAUSE link declare _why_ a certain event/occurrence took place. That is not really applicable to for example an orchestrated pipeline driven by for example Jenkins Pipeline or Argo Workflows, where the orchestrator determines why to start a certain activity rather than an activity being triggered by an earlier event. In other words, there is no direct _causal_ relationship between an activity triggered by an orchestrator and a previous activity in the same pipeline triggered by the same orchestrator. | ||
| - If a CAUSE link should be used to explicitly connect pipeline step activities, it would often be used between the ActT of a step to ActF or a previous step, but an activity could also be CAUSEd by a previous activity being triggered or started, or even by an internal occurrence within an activity. To deal with all scenarios an event consumer would need to consider all such combinations instead of just relying on links between ActT (or TSS) events. | ||
| - When parallel pipeline steps are followed by a single pipeline step a CAUSE link could be used to all those parallel steps activity events, but it might be more natural to only have the CAUSE link to one of them, depending on the scenario. Adding a new link type (PRECURSOR) provides the possibility to connect these activity events without needing to use CAUSE links to tie activities together which do not actually have a causal relationship to each other. | ||
|
|
||
| <!-- Bookmarks section --> | ||
| [ActT]: ../eiffel-vocabulary/EiffelActivityTriggeredEvent.md | ||
| [ArtC]: ../eiffel-vocabulary/EiffelArtifactCreatedEvent.md | ||
| [ArtP]: ../eiffel-vocabulary/EiffelArtifactPublishedEvent.md | ||
| [CLM]: ../eiffel-vocabulary/EiffelConfidenceLevelModifiedEvent.md | ||
| [FCD]: ../eiffel-vocabulary/EiffelFlowContextDefinedEvent.md | ||
| [SCC]: ../eiffel-vocabulary/EiffelSourceChangeCreatedEvent.md | ||
| [SCS]: ../eiffel-vocabulary/EiffelSourceChangeSubmittedEvent.md | ||
| [TCT]: ../eiffel-vocabulary/EiffelTestCaseTriggeredEvent.md | ||
| [TSS]: ../eiffel-vocabulary/EiffelTestSuiteStartedEvent.md | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.