ashb commented on code in PR #53393: URL: https://github.com/apache/airflow/pull/53393#discussion_r2223060036
########## airflow-core/src/airflow/utils/weight_rule.py: ########## @@ -21,19 +21,8 @@ import methodtools -# Databases do not support arbitrary precision integers, so we need to limit the range of priority weights. -# postgres: -2147483648 to +2147483647 (see https://www.postgresql.org/docs/current/datatype-numeric.html) -# mysql: -2147483648 to +2147483647 (see https://dev.mysql.com/doc/refman/8.4/en/integer-types.html) -# sqlite: -9223372036854775808 to +9223372036854775807 (see https://sqlite.org/datatype3.html) -DB_SAFE_MINIMUM = -2147483648 -DB_SAFE_MAXIMUM = 2147483647 - - -def db_safe_priority(priority_weight: int) -> int: - """Convert priority weight to a safe value for the database.""" - return max(DB_SAFE_MINIMUM, min(DB_SAFE_MAXIMUM, priority_weight)) - +# TODO: This can be moved to airflow-shared once it is available Review Comment: Similar with TriggerRule, this should be an enum defined in the extra ExecAPI spec, so we share it via the spec, not via sharing the code. A useful rule of thumb for when we want to share via the OpenAPI spec: Would this be useful/needed in the future when we have the ability to define DAGs in another language? If so -> enum in spec is the way to go. -- 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]
