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 2020/12/15 11:35:23 UTC

[GitHub] [airflow] PalashPaul-Ingka edited a comment on issue #11377: "run id already exists" error when attempting to schedule multiple dag runs per second

PalashPaul-Ingka edited a comment on issue #11377:
URL: https://github.com/apache/airflow/issues/11377#issuecomment-745232500


   @djrut please use the below code it working
   
   client_id = os.getenv("CLIENT_ID")
       # This should be part of your webserver's URL:
       # {tenant-project-id}.appspot.com
       webserver_id = os.getenv("TENANT_PROJECT")
       # The name of the DAG you wish to trigger
       dag_name = os.getenv("DAG_NAME")
       webserver_url = (
           'https://'
           + webserver_id
           + '.appspot.com/api/experimental/dags/'
           + dag_name
           + '/dag_runs'
       )
       # Make a POST request to IAP which then Triggers the DAG
       run_id = datetime.utcnow().strftime('alpaca_%Y-%m-%dT%H:%M:%S.%f')
   
       conf = {"conf": data}
       print(f"JSON body = {conf}")
   
       make_iap_request(
           webserver_url, client_id, method='POST', json={"conf": data, "run_id": run_id, "replace_microseconds": False})


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