You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/01/18 11:09:37 UTC

[GitHub] [airflow] seybi87 opened a new issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

seybi87 opened a new issue #13740:
URL: https://github.com/apache/airflow/issues/13740


   
   **Apache Airflow version**:
   
   2.0.0
   
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**: OpenStack -> VM -> Docker container 
   - **OS** (e.g. from /etc/os-release): Debian GNU/Linux 10 (buster)
   - **Kernel** (e.g. `uname -a`): Linux 77f8efd77516 4.4.0-193-generic #224-Ubuntu
   
   
   **What happened**:
   
   I am trying to trigger a DAG run via the new stable REST-API `1.0.0` by using a Java-based client. The Java client is generated from the Airflow OpenAPI specification with OpenAPI generator version `5.0.0` . 
   
   In Airflow  I have one active DAG `demo`
   
   I trigger the DAG execution via the java client with the following code snippet:
   
   ```
   ApiClient defaultClient = Configuration.getDefaultApiClient();
   defaultClient.setBasePath("http://1.2.3.4:8080/api/v1);
   DagRunApi dagRunApi = new DagRunApi(defaultClient);
   DAGRun dagRun = new DAGRun();
   try {
         DAGRun result = dagRunApi.postDagRun("demo", dagRun);
   
         LOGGER.debug(result);
   
       } catch (ApiException e) {
         e.printStackTrace();
       }
   
   ```
   
   However, I receive the following exception: 
   
   `BAD REQUEST`
   
   **What you expected to happen**:
   
   By checking the airflow logs it turned out that the  `external_trigger` value of the `DAGRun` is set but this is actually a read-only value and not allowed to be set which results in the `BAD REQUEST` response.
   
   Adding the `nullable: true`  setting to the  `external_trigger` and recreating the java client resolved the issue!
   
   ```
   external_trigger:
             type: boolean
             nullable: true
             readOnly: true
   ```          
   
   
   
   **How to reproduce it**:
   
   Create the Java client (probably any client will produce this error) via OpenAPI generator: 
   
   1. `java -jar codegen/openapi-generator-cli-5.0.0.jar generate -i openapi.yaml -g java  -o .`
   2. create a simple java class and apply the code snippets from above
   
   
   


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

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



[GitHub] [airflow] seybi87 edited a comment on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
seybi87 edited a comment on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764703137






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

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



[GitHub] [airflow] seybi87 edited a comment on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
seybi87 edited a comment on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764703137


   The issues is caused because the `external_trigger`  property is defined with  `default: true `.
   This results in an object `DAGRun dagRun = new DAGRun();` that has set the `external_trigger` value yet the Airflow server apin only accepts null values (as specified for the other DAGRun properties).
   
   


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

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



[GitHub] [airflow] seybi87 commented on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
seybi87 commented on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764703137






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

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



[GitHub] [airflow] kaxil commented on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
kaxil commented on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764693391






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

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



[GitHub] [airflow] seybi87 commented on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
seybi87 commented on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764703137


   The issues is caused because the external_trigger`  property is defined with  `default: true `.
   This results in an object `DAGRun dagRun = new DAGRun();` that has set the `external_trigger` value yet the Airflow server apin only accepts null values (as specified for the other DAGRun properties).
   
   


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

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



[GitHub] [airflow] mik-laj commented on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764836571


   https://github.com/OpenAPITools/openapi-generator/issues/4190
   It looks related. 


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

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



[GitHub] [airflow] ephraimbuddy removed a comment on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
ephraimbuddy removed a comment on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-765165714


   > Yes, you are right, this should be handled by the generator. So feel free to close this issue.
   > 
   > Just out of curiosity, did you test the `postDagRun` call with the Airflow go client?
   > 
   > This would show if the error only occurs for the `java client` parts of code generator or for different languages.
   
   I have triggered dagrun through python client and it worked fine. The OpenAPI generator is not perfect, you need to do some work on the generated code to get it working fine.
   Having said that, @mik-laj I think we need to remove the `default=True` argument, it's not necessary there, I think? though it's not affecting anything. What do you think?


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

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



[GitHub] [airflow] mik-laj closed issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
mik-laj closed issue #13740:
URL: https://github.com/apache/airflow/issues/13740


   


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

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



[GitHub] [airflow] mik-laj closed issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
mik-laj closed issue #13740:
URL: https://github.com/apache/airflow/issues/13740


   


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

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



[GitHub] [airflow] mik-laj commented on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764838289


   > Just out of curiosity, did you test the postDagRun call with the Airflow go client?
   
   @houqp Can you check it?


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

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



[GitHub] [airflow] mik-laj commented on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764784189


   @kaxil This looks like an error in the generator. This field is marked read-only and should never be sent for POST requests in the request body.  This should be fixed in the generator, not in the specification.


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

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



[GitHub] [airflow] kaxil commented on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
kaxil commented on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764786380


   @seybi87 Like @mik-laj said -- it looks like an error in generator as we already mark the field readOnly so we don't expect a value for it


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

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



[GitHub] [airflow] ephraimbuddy commented on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
ephraimbuddy commented on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-765165714


   > Yes, you are right, this should be handled by the generator. So feel free to close this issue.
   > 
   > Just out of curiosity, did you test the `postDagRun` call with the Airflow go client?
   > 
   > This would show if the error only occurs for the `java client` parts of code generator or for different languages.
   
   I have triggered dagrun through python client and it worked fine. The OpenAPI generator is not perfect, you need to do some work on the generated code to get it working fine.
   Having said that, @mik-laj I think we need to remove the `default=True` argument, it's not necessary there, I think? though it's not affecting anything. What do you think?


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

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



[GitHub] [airflow] kaxil commented on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
kaxil commented on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764693391


   Not sure why it is giving you error, the default value is `True`:
   
   https://github.com/apache/airflow/blob/9d9ef1addc44bb1553cf392f598366fd241c05c4/airflow/api_connexion/schemas/dag_run_schema.py#L63
   
   https://github.com/apache/airflow/blob/9d9ef1addc44bb1553cf392f598366fd241c05c4/airflow/api_connexion/openapi/v1.yaml#L1553-L1556
   
   cc @ephraimbuddy @mik-laj 


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

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



[GitHub] [airflow] mik-laj commented on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764784189






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

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



[GitHub] [airflow] seybi87 commented on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
seybi87 commented on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764837159


   Yes, you are right, this should be handled by the generator.  So feel free to close this issue.
   
   Just out of curiosity, did you test the `postDagRun` call with the Airflow go client?
   
   This would show if the error only occurs for the `java client` parts of code generator or for different languages. 


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

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



[GitHub] [airflow] seybi87 edited a comment on issue #13740: Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set

Posted by GitBox <gi...@apache.org>.
seybi87 edited a comment on issue #13740:
URL: https://github.com/apache/airflow/issues/13740#issuecomment-764703137


   The issues is caused because the `external_trigger`  property is defined with  `default: true `.
   This results in an object `DAGRun dagRun = new DAGRun();` that has set the `external_trigger` value yet the Airflow server API only accepts null values (as specified for the other DAGRun properties).
   
   


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

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