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
abbf29b9
Commit
abbf29b9
authored
3 years ago
by
Jedrzej Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
output as DAG parameter and new version of airflow to properly work with ssh keys
parent
0ecdeb08
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dags/taskflow.py
+10
-2
10 additions, 2 deletions
dags/taskflow.py
dockers/docker-compose.yaml
+1
-1
1 addition, 1 deletion
dockers/docker-compose.yaml
with
11 additions
and
3 deletions
dags/taskflow.py
+
10
−
2
View file @
abbf29b9
...
...
@@ -3,6 +3,7 @@ from airflow.decorators import dag, task
from
airflow.models.connection
import
Connection
from
airflow.providers.ssh.hooks.ssh
import
SSHHook
from
airflow.utils.dates
import
days_ago
import
os
from
b2shareoperator
import
(
download_file
,
get_file_list
,
get_object_md
,
get_objects
)
...
...
@@ -45,13 +46,20 @@ def taskflow_example():
return
name_mappings
@task
()
def
load
(
files
:
dict
):
def
load
(
files
:
dict
,
**
kwargs
):
print
(
f
"
Total files downloaded:
{
len
(
files
)
}
"
)
params
=
kwargs
[
'
params
'
]
if
'
target
'
not
in
params
:
target
=
'
/tmp/
'
print
(
f
"
Using default target
{
target
}
"
)
else
:
target
=
params
[
'
target
'
]
ssh_hook
=
SSHHook
(
ssh_conn_id
=
'
default_ssh
'
)
with
ssh_hook
.
get_conn
()
as
ssh_client
:
sftp_client
=
ssh_client
.
open_sftp
()
for
[
truename
,
local
]
in
files
.
items
():
sftp_client
.
put
(
local
,
f
"
/tmp/
{
truename
}
"
)
sftp_client
.
put
(
local
,
os
.
path
.
join
(
target
,
truename
)
)
data
=
extract
()
files
=
transform
(
data
)
...
...
This diff is collapsed.
Click to expand it.
dockers/docker-compose.yaml
+
1
−
1
View file @
abbf29b9
...
...
@@ -44,7 +44,7 @@
version
:
'
2.4'
x-airflow-common
:
&airflow-common
image
:
${AIRFLOW_IMAGE_NAME:-apache/airflow:2.1.
2
}
image
:
${AIRFLOW_IMAGE_NAME:-apache/airflow:2.1.
3
}
environment
:
&airflow-common-env
AIRFLOW__CORE__EXECUTOR
:
CeleryExecutor
...
...
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