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
af9aab12
Commit
af9aab12
authored
3 years ago
by
Jedrzej Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
default host ist bsc now
parent
48aa3915
No related branches found
No related tags found
No related merge requests found
Pipeline
#95813
failed
3 years ago
Stage: test
Stage: build
Stage: deploy
Stage: test-deployment
Stage: cleanup
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
dags/conn_deco.py
+1
-1
1 addition, 1 deletion
dags/conn_deco.py
dags/decors.py
+2
-2
2 additions, 2 deletions
dags/decors.py
dags/taskflow.py
+1
-1
1 addition, 1 deletion
dags/taskflow.py
dags/uploadflow.py
+2
-2
2 additions, 2 deletions
dags/uploadflow.py
with
6 additions
and
6 deletions
dags/conn_deco.py
+
1
−
1
View file @
af9aab12
...
@@ -23,7 +23,7 @@ def conn_decorator():
...
@@ -23,7 +23,7 @@ def conn_decorator():
def
doing_nothing
(
conn_id
):
def
doing_nothing
(
conn_id
):
print
(
f
"
Using connection
{
conn_id
}
"
)
print
(
f
"
Using connection
{
conn_id
}
"
)
ssh_hook
=
get_connection
(
conn_id
=
conn_id
)
ssh_hook
=
get_connection
(
conn_id
=
conn_id
,
default_host
=
'
amdlogin.bsc.es
'
)
with
ssh_hook
.
get_conn
()
as
ssh_client
:
with
ssh_hook
.
get_conn
()
as
ssh_client
:
sftp_client
=
ssh_client
.
open_sftp
()
sftp_client
=
ssh_client
.
open_sftp
()
print
(
"
Connected
"
)
print
(
"
Connected
"
)
...
...
This diff is collapsed.
Click to expand it.
dags/decors.py
+
2
−
2
View file @
af9aab12
...
@@ -29,7 +29,7 @@ def create_temp_connection(rrid, params):
...
@@ -29,7 +29,7 @@ def create_temp_connection(rrid, params):
return
conn_id
return
conn_id
def
get_connection
(
conn_id
):
def
get_connection
(
conn_id
,
default_host
=
'
amdlogin.bsc.es
'
):
if
conn_id
.
startswith
(
'
vault
'
):
if
conn_id
.
startswith
(
'
vault
'
):
vault_hook
=
VaultHook
(
vault_conn_id
=
'
my_vault
'
)
vault_hook
=
VaultHook
(
vault_conn_id
=
'
my_vault
'
)
con
=
vault_hook
.
get_secret
(
con
=
vault_hook
.
get_secret
(
...
@@ -37,7 +37,7 @@ def get_connection(conn_id):
...
@@ -37,7 +37,7 @@ def get_connection(conn_id):
print
(
f
"
Got some values from vault
{
list
(
con
.
keys
())
}
"
)
print
(
f
"
Got some values from vault
{
list
(
con
.
keys
())
}
"
)
# for now SSH is hardcoded
# for now SSH is hardcoded
host
=
con
.
get
(
'
host
'
,
'
bsc
'
)
host
=
con
.
get
(
'
host
'
,
default_host
)
port
=
int
(
con
.
get
(
'
port
'
,
22
))
port
=
int
(
con
.
get
(
'
port
'
,
22
))
hook
=
SSHHook
(
remote_host
=
host
,
port
=
port
,
username
=
con
[
'
userName
'
])
hook
=
SSHHook
(
remote_host
=
host
,
port
=
port
,
username
=
con
[
'
userName
'
])
# key in vault should be in form of formated string:
# key in vault should be in form of formated string:
...
...
This diff is collapsed.
Click to expand it.
dags/taskflow.py
+
1
−
1
View file @
af9aab12
...
@@ -58,7 +58,7 @@ def taskflow_example():
...
@@ -58,7 +58,7 @@ def taskflow_example():
target
=
params
.
get
(
'
target
'
,
'
/tmp/
'
)
target
=
params
.
get
(
'
target
'
,
'
/tmp/
'
)
print
(
f
"
Using
{
connection_id
}
connection
"
)
print
(
f
"
Using
{
connection_id
}
connection
"
)
ssh_hook
=
get_connection
(
conn_id
=
connection_id
)
ssh_hook
=
get_connection
(
conn_id
=
connection_id
,
default_host
=
'
amdlogin.bsc.es
'
)
with
ssh_hook
.
get_conn
()
as
ssh_client
:
with
ssh_hook
.
get_conn
()
as
ssh_client
:
sftp_client
=
ssh_client
.
open_sftp
()
sftp_client
=
ssh_client
.
open_sftp
()
...
...
This diff is collapsed.
Click to expand it.
dags/uploadflow.py
+
2
−
2
View file @
af9aab12
...
@@ -11,7 +11,7 @@ from airflow.utils.dates import days_ago
...
@@ -11,7 +11,7 @@ from airflow.utils.dates import days_ago
from
b2shareoperator
import
(
add_file
,
create_draft_record
,
get_community
,
from
b2shareoperator
import
(
add_file
,
create_draft_record
,
get_community
,
submit_draft
)
submit_draft
)
from
decors
import
remove
,
setup
from
decors
import
remove
,
setup
,
get_connection
default_args
=
{
default_args
=
{
'
owner
'
:
'
airflow
'
,
'
owner
'
:
'
airflow
'
,
...
@@ -45,7 +45,7 @@ def upload_example():
...
@@ -45,7 +45,7 @@ def upload_example():
target
=
params
.
get
(
'
target
'
,
'
/tmp/
'
)
target
=
params
.
get
(
'
target
'
,
'
/tmp/
'
)
source
=
params
.
get
(
'
source
'
,
'
/tmp/
'
)
source
=
params
.
get
(
'
source
'
,
'
/tmp/
'
)
ssh_hook
=
SSHHook
(
ssh_
conn_id
=
connection_id
)
ssh_hook
=
get_connection
(
conn_id
=
connection_id
,
default_host
=
'
amdlogin.bsc.es
'
)
with
ssh_hook
.
get_conn
()
as
ssh_client
:
with
ssh_hook
.
get_conn
()
as
ssh_client
:
sftp_client
=
ssh_client
.
open_sftp
()
sftp_client
=
ssh_client
.
open_sftp
()
lst
=
sftp_client
.
listdir
(
path
=
source
)
lst
=
sftp_client
.
listdir
(
path
=
source
)
...
...
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