Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Data Logistics Service
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eFlows4HPC WP2
Data Logistics Service
Commits
d1d0fe97
Commit
d1d0fe97
authored
3 years ago
by
Jedrzej Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
wip: another way of mixing with taskflow
parent
b6b81e31
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
dags/conn_deco.py
+5
-2
5 additions, 2 deletions
dags/conn_deco.py
with
5 additions
and
2 deletions
dags/conn_deco.py
+
5
−
2
View file @
d1d0fe97
...
@@ -97,9 +97,10 @@ def conn_decorator():
...
@@ -97,9 +97,10 @@ def conn_decorator():
@task
()
@task
()
def
doing_nothing
(
**
kwargs
):
def
doing_nothing
(
a_id
,
**
kwargs
):
conn_id
=
get_conn_id
(
**
kwargs
)
conn_id
=
get_conn_id
(
**
kwargs
)
print
(
f
"
Just doing nothing with
{
conn_id
}
"
)
print
(
f
"
Just doing nothing with
{
conn_id
}
"
)
print
(
f
"
I also got
"
,
a_id
)
ssh_hook
=
get_connection
(
conn_id
=
conn_id
)
ssh_hook
=
get_connection
(
conn_id
=
conn_id
)
with
ssh_hook
.
get_conn
()
as
ssh_client
:
with
ssh_hook
.
get_conn
()
as
ssh_client
:
...
@@ -112,7 +113,9 @@ def conn_decorator():
...
@@ -112,7 +113,9 @@ def conn_decorator():
return
conn_id
return
conn_id
conn_id
=
PythonOperator
(
python_callable
=
setup
,
task_id
=
'
setup_connection
'
)
conn_id
=
PythonOperator
(
python_callable
=
setup
,
task_id
=
'
setup_connection
'
)
dno
=
doing_nothing
()
# another way of mixing taskflow and classical api:
a_id
=
conn_id
.
output
[
'
return_value
'
]
dno
=
doing_nothing
(
a_id
=
a_id
)
en
=
PythonOperator
(
python_callable
=
remove
,
op_kwargs
=
{
'
conn_id
'
:
dno
},
task_id
=
'
cleanup
'
)
en
=
PythonOperator
(
python_callable
=
remove
,
op_kwargs
=
{
'
conn_id
'
:
dno
},
task_id
=
'
cleanup
'
)
conn_id
>>
dno
>>
en
conn_id
>>
dno
>>
en
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment