Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop instrumenting api for create for now #111

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions api/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from airflow_client.client.model.connection import Connection

from flask import abort
from flask import Response

from jinja2 import Environment, FileSystemLoader

Expand Down Expand Up @@ -193,27 +194,30 @@ def create_breeder(api_client, content):

time.sleep(2) # wait as workaround until synchronous reload of dags implemented

dag_run = DAGRun(
dag_run_id=breeder_id ,
#state=DagState("queued"),
conf=breeder_config,
) # DAGRun |
# Stop calling the API for now until decided
# if we template the breeder dags only or we really want to instrument the API.

try:
# Trigger a new DAG run
_api_response = api_instance.post_dag_run(breeder_id, dag_run)
except client.ApiException as e:
print("Exception when calling DAGRunApi->post_dag_run: %s\n" % e)
raise e
return _api_response
#dag_run = DAGRun(
# dag_run_id=breeder_id ,
# #state=DagState("queued"),
# conf=breeder_config,
#) # DAGRun |

#try:
# # Trigger a new DAG run
# _api_response = api_instance.post_dag_run(breeder_id, dag_run)
#except client.ApiException as e:
# print("Exception when calling DAGRunApi->post_dag_run: %s\n" % e)
# raise e
#return _api_response

with client.ApiClient(configuration) as api_client:
# Do not create connection dynamically for now
# api_response['connection'] = create_connection(api_client, content).to_dict()
api_response['breeder'] = create_breeder(api_client, content).to_dict()


return api_response
return Response(dict(), status=200, mimetype='application/json')


def breeders_put(content): # noqa: E501
Expand Down