airflow.api_connexion.endpoints.dag_endpoint.patch_dag -->> Property is read-only - '****'

Created on 22 Aug 2020  Â·  14Comments  Â·  Source: apache/airflow

Apache Airflow version:
Airflow Master master-python3.8-ci docker pull apache/airflow:master-python3.8-ci DIGEST:sha256:a4cf33bdbde82b6db6a89b967f4d51ba20101ef815b8bc504cbd9ac1cb659018 Last updated4 days agobypotiuk

Kubernetes version (if you are using kubernetes) (use kubectl version):

Environment:

  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

What happened:
API(airflow.api_connexion.endpoints.dag_endpoint.patch_dag) update any DAG info response are:
400 Property is read-only - '**'

➜ ~ curl -v -H "Content-Type: application/json" -X PATCH --data '{ "description": null, "is_paused": true, "schedule_interval": { "__type": "CronExpression", "value": "0 0 * * *" }, "tags": [ { "name": "example" } ]}' http://******/api/v1/dags/example_bash_operator


*   Trying 118.*****...
* TCP_NODELAY set
* Connected to* (#0)
> PATCH /api/v1/dags/example_bash_operator HTTP/1.1
> Host: *
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 325
>
* upload completely sent off: 325 out of 325 bytes
< HTTP/1.1 400 BAD REQUEST
< Server: gunicorn/19.10.0
< Date: Sat, 22 Aug 2020 09:29:08 GMT
< Connection: close
< Content-Type: application/problem+json
< Content-Length: 119
< X-Frame-Options: DENY
< Vary: Cookie
< Set-Cookie: session=eyJfcGVybWFuZW50Ijp0cnVlfQ.X0DlZA.1F_VrxgrmOQWHSaA9d_b1czM9SU; Expires=Mon, 21-Sep-2020 09:29:08 GMT; HttpOnly; Path=/
<
{
  "detail": "Property is read-only - 'description'",
  "status": 400,
  "title": "Bad Request",
  "type": "about:blank"
}
* Closing connection 0

What you expected to happen:

How to reproduce it:

Anything else we need to know:

bug

All 14 comments

This has been fixed in https://github.com/apache/airflow/pull/9740 . Can you test it with the latest master

Is there a docker image whit the latest master?

It should be built nightly on DockerHub but for latest master it can be pulled from dockerhub

See IMAGES.rst or best you can build it yourself and enter the image using breeze. see BREEZE.rst

Simply checking out the latest master and.running './breeze's should pull&rebuild the image as needed and drop you in the container where you can run tmux, reset the db, start scheduler/ webserver and run the whole Airflow

Here is the CI build, that let's you use all the test tool (python 3.6 : https://github.com/apache/airflow/packages/196408 ) but you find other versions at https://github.com/apache/airflow/packages

All the details on using and runnint the images are in https://github.com/apache/airflow/blob/master/IMAGES.rst

Looking forward to your feedback @xu-xiang

Thank you. I'll test it again.

I have test it with the latest master. But still respond "Property is read-only - 'description'"

(airflowenv) ➜ github curl -v -X PATCH -H "Content-Type: application/json" --data '{ "description": null}' http://127.0.0.1:8080/api/v1/dags/example_bash_operator
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PATCH /api/v1/dags/example_bash_operator HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 22
>
* upload completely sent off: 22 out of 22 bytes
< HTTP/1.1 400 BAD REQUEST
< Server: gunicorn/19.10.0
< Date: Mon, 24 Aug 2020 17:37:40 GMT
< Connection: close
< Content-Type: application/problem+json
< Content-Length: 124
< X-Frame-Options: DENY
< Vary: Cookie
< Set-Cookie: session=eyJfcGVybWFuZW50Ijp0cnVlfQ.X0P65A.kt8QcmvtFZ4pXpx9JX1lEjO33rI; Expires=Wed, 23-Sep-2020 17:37:40 GMT; HttpOnly; Path=/
<
{
  "detail": "Property is read-only - 'description'",
  "status": 400,
  "title": "Bad Request",
  "type": "about:blank"
}
* Closing connection 0
(airflowenv) ➜ github

Would you like to create a PR to fix it? @xu-xiang

cc @ephraimbuddy @OmairK

@kaxil Yes. I'm happy to help. You can assign it to me

The description is a read-only field according to spec. This field contains the value that is synchronized with the DAG File, so if you want to update this description, you need to edit the DAG File.
Screenshot 2020-08-24 at 21 36 17
https://airflow.readthedocs.io/en/latest/stable-rest-api-ref.html#operation/patch_dag
However, I can see that there is one mistake here. The update_mask field is missing to maintain future compatibility.

Whoops so only is_paused field can be patched .. right!

Hi @mik-laj , should I work only on the update_mask field and tag this issue to close?

@ephraimbuddy Yes. We can close this ticket.

Was this page helpful?
0 / 5 - 0 ratings