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
a59e2604
Commit
a59e2604
authored
3 years ago
by
Jedrzej Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
reg with md retrieval
parent
10d7f8d6
No related branches found
No related tags found
No related merge requests found
Pipeline
#97030
passed
3 years ago
Stage: test
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dags/just_reg.py
+15
-3
15 additions, 3 deletions
dags/just_reg.py
with
15 additions
and
3 deletions
dags/just_reg.py
+
15
−
3
View file @
a59e2604
from
urllib.parse
import
urljoin
from
airflow.decorators
import
dag
,
task
from
airflow.models.connection
import
Connection
from
airflow.operators.bash
import
BashOperator
...
...
@@ -47,19 +47,31 @@ def datacat_registration_example():
)
try
:
r
=
hook
.
create_entry
(
datacat_type
=
'
dataset
'
,
entry
=
entry
)
print
(
"
Hook registration returned:
"
,
r
,
urljoin
(
hook
.
connection
.
url
,
r
)
)
print
(
"
Hook registration returned:
"
,
r
)
return
r
except
ConnectionError
as
e
:
print
(
'
Registration failed
'
,
e
)
return
-
1
@task
def
get_template
():
hook
=
DataCatalogHook
()
print
(
"
Connected to datacat via hook
"
,
hook
.
list_type
(
'
dataset
'
))
mid
=
'
71e863ac-aee6-4680-a57c-de318530b71e
'
entry
=
hook
.
get_entry
(
datacat_type
=
'
storage_target
'
,
oid
=
mid
)
print
(
entry
)
print
(
entry
[
'
metadata
'
])
step1
=
BashOperator
(
bash_command
=
'
ls
'
,
task_id
=
'
nothing
'
)
step2
=
register
(
object_url
=
'
https://b2share-testing.fz-juelich.de/records/7a12fda26b2a4d248f96d012d54769b7
'
)
step1
>>
step2
step3
=
get_template
()
step1
>>
step2
>>
step3
dag
=
datacat_registration_example
()
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