o-nikolas commented on issue #19264: URL: https://github.com/apache/airflow/issues/19264#issuecomment-955070130
So after poking at this a bit more, I don't think it's possible with the current schema: At the point where we're creating the extra link we have access to the dag id, execution time and task_id of the trigger**ing** dag/task. From which we can also query for the dag run and the task instance objects. However, none of these are sufficient to query for the trigger**ed** dag run. We know the id of the trigger**ed** dag but we don't know the run_id or the execution time of the trigger**ed** dag run since these are computed in `execute` of the trigger**ing** dag (unless they are provided by the user as arguments to the operator, in which case we have them) and are not persisted or left as a bread crumbs. When we create the trigger**ed** dag run, the only noteworthy thing we set is `externally_triggered=True`, but we don't set *what* externally triggered it. As far as I can tell we simply don't have a field in dag run model to represent what entity externally triggered the dag (whether it be by another dag like in this case, or the cli run dag api, etc). So until we add something like that I think it is impossible to link to the proper location in all cases. Please do correct me if any of the above is wrong though. Paths forward: 1. Remove the execution time from the extra link and just link to the trigger**ed** dag id alone. This will show the full history of dag runs (up to the default 25 runs of course) and the user can do further filtering if required by hand 2. 1b) in addition to 1. add the execution time to the url or fetch it from the dag_run if the user provides those optional inputs to the operator. Though this will lead to differing behaviour depending on whether or not those inputs are provided and it may not be clear to the customer why they're seeing said differing behaviour. This is an optimization that may or may not be worth it. 3. Update the dag run model to include a new field which represents what **externally** triggered that dag run if `externally_triggered` is true. This way we can do a query in the future, when building the link, for all dag runs that were triggered by a specific previous dag run (hopefully that makes sense). This is easy to kludge but obviously any changes to the DB schema needs to be done with great care and thoughtfulness. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
