mykola-shyshov commented on issue #58303:
URL: https://github.com/apache/airflow/issues/58303#issuecomment-3534360883

   scheduler deactivate assets in case they are not in outlet and are not 
referenced by DAG
   
   
   > Check assets orphanization and update their active entry.  An orphaned 
asset is no longer referenced in any DAG schedule parameters
           or task outlets. Active assets (non-orphaned) have entries in 
AssetActive
           and must have unique names and URIs.
   
   This issue is relevant for DAGs scheduled by time.
   I think the next fix will work
   
   ```
           orphaned = (
               (func.count(DagScheduleAssetReference.dag_id) + 
func.count(TaskOutletAssetReference.dag_id) + 
func.count(TaskInletAssetReference.dag_id)) == 0
           ).label("orphaned")
           asset_reference_query = session.execute(
               select(orphaned, AssetModel)
               .outerjoin(DagScheduleAssetReference)
               .outerjoin(TaskOutletAssetReference)
               .outerjoin(TaskInletAssetReference)
               .group_by(AssetModel.id)
               .order_by(orphaned)
           )
   ```
   
   will prepare PR
   


-- 
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]

Reply via email to