Git Product home page Git Product logo

Comments (10)

fanqingsong avatar fanqingsong commented on May 30, 2024

I encountered the same problem.
and I found the test case (airflow_client/test/test_dag_run_api.py) is just shell, with empty test function.
so I think the quality cannot be assured currently.
mybe using raw REST API is a good choice.

from airflow-client-python.

zjaxxon avatar zjaxxon commented on May 30, 2024

Same problem. It seems you must provide a dag_id to initialize a DAGRun while it gives this read-only error in post_dag_run.

from airflow-client-python.

hterik avatar hterik commented on May 30, 2024

Same problem here after following https://github.com/apache/airflow-client-python/blob/master/airflow_client/docs/DAGRunApi.md#post_dag_run.
DAGRun requires dag_id in its constructor, but if you provide one the post_dag_run will give the Property is read-only error.
So basically it's not possible to start dagruns using the client.

airflow-client-python.git rev bf439f3
Airflow 2.2.0

from airflow-client-python.

hterik avatar hterik commented on May 30, 2024

Probably caused by #4

from airflow-client-python.

christhekeele avatar christhekeele commented on May 30, 2024

I have worked around this by re-generating the api client for airflow 2.3.0 with this patch applied. Available from my fork. You can install it in a requirements.txt via:

# apache-airflow-client==2.1.0
-e git://github.com/christhekeele/[email protected]#egg=apache-airflow-client

from airflow-client-python.

sureshdsk avatar sureshdsk commented on May 30, 2024

Is there any alternate way to trigger task without this client?

from airflow-client-python.

hterik avatar hterik commented on May 30, 2024

Is there any alternate way to trigger task without this client?

https://airflow.apache.org/docs/apache-airflow/2.2.4/stable-rest-api-ref.html

from airflow-client-python.

sureshdsk avatar sureshdsk commented on May 30, 2024

POST /api/v1/dags/{dag_id}/dagRuns

{
  "conf": {},
  "dag_run_id": "test-1",
  "logical_date": "2022-05-25T07:12:59.305Z",
  "state": "queued"
}

results in below error.

{
    "detail": "Property is read-only - 'state'",
    "status": 400,
    "title": "Bad Request",
    "type": "https://airflow.apache.org/docs/apache-airflow/2.2.3/stable-rest-api-ref.html#section/Errors/BadRequest"
}

without "state" param in the payload works 👍

from airflow-client-python.

VeereshPatil avatar VeereshPatil commented on May 30, 2024

you can not pass dag_id and external_trigger as part of DagRun ( dag_id is passed in post_dag_run() function)
The following worked for me,

dag_run = DAGRun(
            dag_run_id='some_test_run',
            conf={"key":"values"}
            )
api_response = dag_run_api_instance.post_dag_run(dag_id, dag_run)

from airflow-client-python.

pierrejeambrun avatar pierrejeambrun commented on May 30, 2024

dag_id, state and external_trigger are now read only. They should not be provided in the DagRun object. With the latest client (2.5.1) we can trigger dag runs like this:

    # DagRun
    dag_run_api_instance = dag_run_api.DAGRunApi(api_client)
    try:
        api_response = dag_run_api_instance.post_dag_run(
            "25616-bug", dag_run_api.DAGRun(dag_run_id="run_from_python_api_client")
        )
        pprint(api_response)
    except airflow_client.client.OpenApiException as e:
        print("Exception when calling DagRunApi->post_dag_run: %s\n" % e)

image

Closing for now, feel free to reopen if needed.

from airflow-client-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.