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
b1020f13
Commit
b1020f13
authored
3 years ago
by
Jedrzej Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
yolo
parent
2190f080
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
dags/b2shareoperator.py
+28
-0
28 additions, 0 deletions
dags/b2shareoperator.py
dags/firsto.py
+3
-0
3 additions, 0 deletions
dags/firsto.py
with
31 additions
and
0 deletions
dags/b2shareoperator.py
0 → 100644
+
28
−
0
View file @
b1020f13
from
airflow.models.baseoperator
import
BaseOperator
from
airflow.models.connection
import
Connection
from
st
import
get_objects
class
B2ShareOperator
(
BaseOperator
):
def
__init__
(
self
,
name
:
str
,
conn_id
:
str
=
'
default_b2share
'
,
**
kwargs
)
->
None
:
super
().
__init__
(
**
kwargs
)
self
.
name
=
name
self
.
connection
=
Connection
.
get_connection_from_secrets
(
conn_id
)
def
execute
(
self
,
context
):
message
=
"
Hello {}
"
.
format
(
self
.
name
)
print
(
message
)
print
(
self
.
connection
.
host
)
print
(
f
"
Retrieving info from
{
self
.
connection
.
host
}
"
)
lst
=
get_objects
(
server
=
self
.
connection
.
schema
+
self
.
connection
.
host
)
print
(
f
"
GOT:
{
lst
}
"
)
return
message
This diff is collapsed.
Click to expand it.
dags/firsto.py
+
3
−
0
View file @
b1020f13
...
@@ -6,6 +6,7 @@ from airflow.utils.dates import days_ago
...
@@ -6,6 +6,7 @@ from airflow.utils.dates import days_ago
from
airflow.operators.bash
import
BashOperator
from
airflow.operators.bash
import
BashOperator
from
b2shareoperator
import
B2ShareOperator
def_args
=
{
def_args
=
{
'
owner
'
:
'
airflow
'
,
'
owner
'
:
'
airflow
'
,
...
@@ -21,5 +22,7 @@ with DAG('firsto', default_args=def_args, description='first dag', schedule_inte
...
@@ -21,5 +22,7 @@ with DAG('firsto', default_args=def_args, description='first dag', schedule_inte
t1
=
BashOperator
(
task_id
=
'
print_date
'
,
bash_command
=
'
date
'
)
t1
=
BashOperator
(
task_id
=
'
print_date
'
,
bash_command
=
'
date
'
)
t2
=
BashOperator
(
task_id
=
'
do_noting
'
,
bash_command
=
'
sleep 5
'
)
t2
=
BashOperator
(
task_id
=
'
do_noting
'
,
bash_command
=
'
sleep 5
'
)
t3
=
B2ShareOperator
(
task_id
=
'
task_b2sh
'
,
dag
=
dag
,
name
=
'
B2Share
'
)
t1
>>
t2
t1
>>
t2
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