You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jens-scheffler-bosch (via GitHub)" <gi...@apache.org> on 2023/08/12 15:33:19 UTC

[GitHub] [airflow] jens-scheffler-bosch commented on a diff in pull request #29174: [WIP] Deprecate dagrun `conf` and add `params` argument for the different APIs

jens-scheffler-bosch commented on code in PR #29174:
URL: https://github.com/apache/airflow/pull/29174#discussion_r1292342502


##########
airflow/api_connexion/openapi/v1.yaml:
##########
@@ -2809,12 +2809,23 @@ components:
           default: true
           readOnly: true
         conf:
+          type: object
+          description: |
+            JSON object describing additional configuration parameters.
+            The value of this field can be set only when creating the object. If you try to modify the
+            field of an existing object, the request fails with an BAD_REQUEST error.
+
+            *Deprecated since version 2.6.0*&#58; Use 'params' instead.
+          deprecated: true
+        params:
           type: object
           description: |
             JSON object describing additional configuration parameters.
 
             The value of this field can be set only when creating the object. If you try to modify the
             field of an existing object, the request fails with an BAD_REQUEST error.
+
+            *New in version 2.6.0*

Review Comment:
   Needs a bit of update if you re-vitalize



##########
airflow/www/templates/airflow/trigger.html:
##########
@@ -164,65 +176,14 @@ <h4 class="panel-title">DAG conf Parameters</h4>
             {% endfor %}
           </tbody>
         </table>
-
-        {% for form_section, form_items in form_fields.values() | groupby(attribute="schema.section", default="") %}

Review Comment:
   Here you remove further sections being displayed... why?



##########
airflow/www/templates/airflow/trigger.html:
##########
@@ -129,7 +129,19 @@ <h2>Trigger DAG: {{ dag_id }}</h2>
         <input type="text" class="form-control" placeholder="Run ID" name="run_id">
       </div>
     </div>
-    {% if recent_confs|length > 0 %}
+    {% if form_fields and recent_params|length > 0 %}
+    <div class="form-group row">

Review Comment:
   Mhm, you really want to add two JSON elements here, to be able to trigger using a conf and a params dict? I'd propose to switch to params from conf in this PR, having two fields rather confuses which to use (in my eyes)



##########
airflow/www/static/js/trigger.js:
##########
@@ -147,18 +147,18 @@ function initForm() {
       });
     });
 
-    // Ensure layout is refreshed on generated JSON as well
-    document.getElementById('generated_json_toggle').addEventListener('click', () => {
-      setTimeout(jsonForm.refresh, 300);
-    });
+    // // Ensure layout is refreshed on generated JSON as well

Review Comment:
   Why did you disable this? Was there an error in testing?
   This is needed because the section is hidden during load of the form and then the JSON view is not correctly initialized - don't know why - workaround was to initialize it lazy by this.



##########
airflow/models/dag.py:
##########
@@ -2627,9 +2665,17 @@ def create_dagrun(
                 stacklevel=3,
             )
 
+        if conf:
+            warnings.warn(
+                "dag_run conf is deprecated. Please use params instead", DeprecationWarning, stacklevel=2

Review Comment:
   Di we need to add a deprecation warning on CLI as well?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org