Skip to content

Commit

Permalink
Merge pull request #2 from eflows4hpc/feature/execution_url
Browse files Browse the repository at this point in the history
Retrieve execution url in order to allow users to more easily access it
  • Loading branch information
loicalbertin committed Jun 22, 2023
2 parents b569e1f + e9d2823 commit 75721d0
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 3 deletions.
1 change: 1 addition & 0 deletions ansible/playbooks/start_in_standard_mode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- name: Set submit tasks file
set_fact:
submit_tasks_file: "{{ submit_tasks }}"
execution_url: ""

- name: Submit and monitor DAG RUN
block:
Expand Down
1 change: 1 addition & 0 deletions ansible/playbooks/submit_dag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- name: Set submit tasks file
set_fact:
submit_tasks_file: "{{ submit_tasks }}"
execution_url: ""

- name: Submit DAG RUN to Airflow
include_tasks: "{{ submit_tasks_file }}"
1 change: 1 addition & 0 deletions ansible/playbooks/submit_dag_generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- name: Set request body
set_fact:
request_body:
dag_run_id: "{{ login }}-{{ 1000000000 | random | to_uuid }}"
conf: "{{ conf | default('{}') | from_json | combine(target_conf) }}"
no_log: True

Expand Down
1 change: 1 addition & 0 deletions ansible/playbooks/submit_dag_http2ssh_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
- name: Set request body
set_fact:
request_body:
dag_run_id: "{{ login }}-{{ 1000000000 | random | to_uuid }}"
conf: "{{ target_conf }}"
no_log: "{{ debug_logs | default('false') == 'false' }}"

Expand Down
3 changes: 3 additions & 0 deletions ansible/playbooks/submit_dag_image_transfer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
port: "{{ port }}"
login: "{{ login }}"
vault_id: "{{ vault_id }}"
url: "{{ image_builder_url }}/images/download/"
vault_path: "{{ image_builder_vault_secret_path }}"
no_log: "{{ debug_logs | default('false') == 'false' }}"

- name: add extra_conf
Expand All @@ -70,6 +72,7 @@
- name: Set request body
set_fact:
request_body:
dag_run_id: "{{ login }}-{{ 1000000000 | random | to_uuid }}"
conf: "{{ target_conf }}"
no_log: "{{ debug_logs | default('false') == 'false' }}"

Expand Down
1 change: 1 addition & 0 deletions ansible/playbooks/submit_dag_stagein_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
- name: Set request body
set_fact:
request_body:
dag_run_id: "{{ login }}-{{ 1000000000 | random | to_uuid }}"
conf: "{{ target_conf }}"
no_log: "{{ debug_logs | default('false') == 'false' }}"

Expand Down
1 change: 1 addition & 0 deletions ansible/playbooks/submit_dag_stageout_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
- name: Set request body
set_fact:
request_body:
dag_run_id: "{{ login }}-{{ 1000000000 | random | to_uuid }}"
conf: "{{ target_conf }}"
no_log: "{{ debug_logs | default('false') == 'false' }}"

Expand Down
4 changes: 4 additions & 0 deletions ansible/playbooks/submit_tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@
- name: Extract TOSCA_JOB_ID
set_fact:
TOSCA_JOB_ID: "{{ content.dag_run_id }}"

- name: Extract execution url
set_fact:
execution_url: "{{ dls_api_url | regex_replace('^(.+)/api.*$', '\\1') }}/graph?dag_id={{ dag_id }}&run_id={{ content.dag_run_id }}"
43 changes: 40 additions & 3 deletions ansible/types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ imports:
- tosca-normative-types:1.0.0-ALIEN20
- alien-base-types:3.0.0
- yorc-types:1.1.0
- eflows4hpc.env:1.0.0
- eflows4hpc.env:1.1.0

node_types:
dls.ansible.nodes.DLSDAGRun:
Expand Down Expand Up @@ -60,6 +60,9 @@ node_types:
capability: eflows4hpc.env.capabilities.ExecutionEnvironment
relationship: tosca.relationships.DependsOn
occurrences: [ 0, UNBOUNDED ]
attributes:
display_url_submit: { get_operation_output: [ SELF, tosca.interfaces.node.lifecycle.Runnable, submit, execution_url ] }
display_url_start: { get_operation_output: [ SELF, Standard, start, execution_url ] }
interfaces:
Standard:
inputs:
Expand All @@ -73,7 +76,11 @@ node_types:
debug_logs: { get_property: [ SELF, debug ] }
conf: { get_property: [ SELF, extra_conf ] }

start: playbooks/start_in_standard_mode.yaml
start:
inputs:
login: { get_property: [ SELF, user_id ] }
vault_id: { get_property: [ SELF, vault_id ] }
implementation: playbooks/start_in_standard_mode.yaml
tosca.interfaces.node.lifecycle.Runnable:
inputs:
submit_tasks: "submit_dag_generic.yaml"
Expand All @@ -85,7 +92,13 @@ node_types:
debug_logs: { get_property: [ SELF, debug ] }
conf: { get_property: [ SELF, extra_conf ] }

submit: playbooks/submit_dag.yaml
submit:
implementation: playbooks/submit_dag.yaml
inputs:
login: { get_property: [ SELF, user_id ] }
vault_id: { get_property: [ SELF, vault_id ] }
login_input: { get_input: user_id }
vault_id_input: { get_input: vault_id }
run: playbooks/monitor_dag.yaml

dls.ansible.nodes.DLSDAGStageInData:
Expand Down Expand Up @@ -115,6 +128,9 @@ node_types:
description:
required: true
default : "target_path"
attributes:
display_url_submit: { get_operation_output: [ SELF, tosca.interfaces.node.lifecycle.Runnable, submit, execution_url ] }
display_url_start: { get_operation_output: [ SELF, Standard, start, execution_url ] }
interfaces:
Standard:
inputs:
Expand Down Expand Up @@ -203,6 +219,9 @@ node_types:
If an input with this name exists for the workflow, it overrides the target_path property.
required: true
default : "target_path"
attributes:
display_url_submit: { get_operation_output: [ SELF, tosca.interfaces.node.lifecycle.Runnable, submit, execution_url ] }
display_url_start: { get_operation_output: [ SELF, Standard, start, execution_url ] }
interfaces:
Standard:
inputs:
Expand Down Expand Up @@ -287,6 +306,9 @@ node_types:
type: string
required: true
default: register
attributes:
display_url_submit: { get_operation_output: [ SELF, tosca.interfaces.node.lifecycle.Runnable, submit, execution_url ] }
display_url_start: { get_operation_output: [ SELF, Standard, start, execution_url ] }
interfaces:
Standard:
inputs:
Expand Down Expand Up @@ -343,6 +365,15 @@ node_types:
metadata:
icon: airflow-icon.png
properties:
image_builder_url:
type: string
description: URL of Image Builder Service API
default: https://eflows4hpc.bsc.es/image_creation
image_builder_vault_secret_path:
type: string
description: path in Vault secret engine of credentials for the Image Builder Service
default: "/services_secrets/image_creation"
required: true
image_id:
type: string
description: The image id to transfer
Expand All @@ -362,6 +393,8 @@ node_types:
attributes:
image_file_path_submit: { get_operation_output: [ SELF, tosca.interfaces.node.lifecycle.Runnable, submit, image_file_path ] }
image_file_path_start: { get_operation_output: [ SELF, Standard, start, image_file_path ] }
display_url_submit: { get_operation_output: [ SELF, tosca.interfaces.node.lifecycle.Runnable, submit, execution_url ] }
display_url_start: { get_operation_output: [ SELF, Standard, start, execution_url ] }
interfaces:
Standard:
inputs:
Expand All @@ -379,6 +412,8 @@ node_types:
inputs:
builded_file_name_start: { get_attribute: [ REQ_TARGET, dependency, filename_start] }
builded_file_name_run: { get_attribute: [ REQ_TARGET, dependency, filename_run] }
image_builder_url: { get_property: [ SELF, image_builder_url ] }
image_builder_vault_secret_path: { get_property: [ SELF, image_builder_vault_secret_path ] }
image_id: { get_property: [ SELF, image_id ] }
target_path: { get_property: [ SELF, target_path ] }
host: { get_property: [ SELF, target_host ] }
Expand All @@ -402,6 +437,8 @@ node_types:
inputs:
builded_file_name_start: { get_attribute: [ REQ_TARGET, dependency, filename_start] }
builded_file_name_run: { get_attribute: [ REQ_TARGET, dependency, filename_run] }
image_builder_url: { get_property: [ SELF, image_builder_url ] }
image_builder_vault_secret_path: { get_property: [ SELF, image_builder_vault_secret_path ] }
image_id: { get_property: [ SELF, image_id ] }
image_id_input: { get_input: image_id }
target_path: { get_property: [ SELF, target_path ] }
Expand Down

0 comments on commit 75721d0

Please sign in to comment.