Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

set-schema: fix #70

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion backoffice/backoffice/workflows/airflow_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def trigger_airflow_dag(dag_id, workflow_id, extra_data=None):
data = {"dag_run_id": str(workflow_id), "conf": {"workflow_id": str(workflow_id)}}

if extra_data is not None:
data["conf"].update(extra_data)
data["conf"]["data"] = extra_data

url = f"{AIRFLOW_BASE_URL}/api/v1/dags/{dag_id}/dagRuns"

Expand Down
7 changes: 5 additions & 2 deletions workflows/dags/author/author_create/author_create_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging

from airflow.decorators import dag, task
from airflow.models import Variable
from airflow.models.param import Param
from hooks.backoffice.workflow_management_hook import AUTHORS, WorkflowManagementHook
from hooks.backoffice.workflow_ticket_management_hook import (
Expand Down Expand Up @@ -50,10 +51,12 @@ def set_workflow_status_to_running(**context):

@task()
def set_schema(**context):
schema = "https://inspirehep.net/schemas/records/authors.json"
schema = Variable.get("author_schema")
workflow_management_hook.partial_update_workflow(
workflow_id=context["params"]["workflow_id"],
workflow_partial_update_data={"data": {"$schema": schema}},
workflow_partial_update_data={
"data": {**context["params"]["data"], "$schema": schema}
},
collection=AUTHORS,
)

Expand Down
3 changes: 2 additions & 1 deletion workflows/scripts/variables/variables.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"backoffice_token": "2e04111a61e8f5ba6ecec52af21bbb9e81732085",
"inspire_token": "CHANGE_ME"
"inspire_token": "CHANGE_ME",
"author_schema": "https://inspirehep.net/schemas/records/authors.json"
}
Loading