Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ckanext-odsh
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open-Data
ckanext-odsh
Commits
59248287
Commit
59248287
authored
6 years ago
by
anonymous
Browse files
Options
Downloads
Patches
Plain Diff
Ignoring already known datasets is no error for kiel and statNord harvesters
parent
b2072135
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
ckanext/odsh/harvesters/kielharvester.py
+7
-0
7 additions, 0 deletions
ckanext/odsh/harvesters/kielharvester.py
ckanext/odsh/harvesters/statistikamtnordharvester.py
+7
-0
7 additions, 0 deletions
ckanext/odsh/harvesters/statistikamtnordharvester.py
with
14 additions
and
0 deletions
ckanext/odsh/harvesters/kielharvester.py
+
7
−
0
View file @
59248287
...
@@ -35,6 +35,7 @@ class KielHarvester(ODSHBaseHarvester):
...
@@ -35,6 +35,7 @@ class KielHarvester(ODSHBaseHarvester):
def
gather_stage
(
self
,
harvest_job
):
def
gather_stage
(
self
,
harvest_job
):
url
=
harvest_job
.
source
.
url
url
=
harvest_job
.
source
.
url
datasets
=
requests
.
get
(
url
=
url
).
json
()
datasets
=
requests
.
get
(
url
=
url
).
json
()
count_known_dataset_ids
=
0
try
:
try
:
used_identifiers
=
[]
used_identifiers
=
[]
...
@@ -54,6 +55,8 @@ class KielHarvester(ODSHBaseHarvester):
...
@@ -54,6 +55,8 @@ class KielHarvester(ODSHBaseHarvester):
str
(
obj
.
id
),
str
(
obj
.
guid
)))
str
(
obj
.
id
),
str
(
obj
.
guid
)))
used_identifiers
.
append
(
guid
)
used_identifiers
.
append
(
guid
)
ids
.
append
(
obj
.
id
)
ids
.
append
(
obj
.
id
)
else
:
count_known_dataset_ids
+=
1
except
Exception
as
e
:
except
Exception
as
e
:
self
.
_save_gather_error
(
self
.
_save_gather_error
(
...
@@ -69,6 +72,10 @@ class KielHarvester(ODSHBaseHarvester):
...
@@ -69,6 +72,10 @@ class KielHarvester(ODSHBaseHarvester):
log
.
debug
(
"
List of gathered IDs: %s
"
%
ids
)
log
.
debug
(
"
List of gathered IDs: %s
"
%
ids
)
log
.
debug
(
"
gather_stage() finished: %s IDs gathered
"
%
len
(
ids
))
log
.
debug
(
"
gather_stage() finished: %s IDs gathered
"
%
len
(
ids
))
return
ids
return
ids
elif
count_known_dataset_ids
>
0
:
log
.
info
(
"
Gathered
"
+
str
(
count_known_dataset_ids
)
+
"
datasets already stored in the database. No new datasets found.
"
)
return
[]
else
:
else
:
log
.
error
(
"
No records received
"
)
log
.
error
(
"
No records received
"
)
self
.
_save_gather_error
(
self
.
_save_gather_error
(
...
...
This diff is collapsed.
Click to expand it.
ckanext/odsh/harvesters/statistikamtnordharvester.py
+
7
−
0
View file @
59248287
...
@@ -37,6 +37,7 @@ class StatistikamtNordHarvester(ODSHBaseHarvester):
...
@@ -37,6 +37,7 @@ class StatistikamtNordHarvester(ODSHBaseHarvester):
def
gather_stage
(
self
,
harvest_job
):
def
gather_stage
(
self
,
harvest_job
):
url
=
harvest_job
.
source
.
url
url
=
harvest_job
.
source
.
url
count_known_dataset_ids
=
0
try
:
try
:
log
.
info
(
'
Stat_Nord_Harvester: Beginning gather stage
'
)
log
.
info
(
'
Stat_Nord_Harvester: Beginning gather stage
'
)
...
@@ -79,6 +80,8 @@ class StatistikamtNordHarvester(ODSHBaseHarvester):
...
@@ -79,6 +80,8 @@ class StatistikamtNordHarvester(ODSHBaseHarvester):
used_identifiers
.
append
(
identifier
)
used_identifiers
.
append
(
identifier
)
ids
.
append
(
obj
.
id
)
ids
.
append
(
obj
.
id
)
log
.
debug
(
'
Save identifier %s from Statistik Nord
'
%
identifier
)
log
.
debug
(
'
Save identifier %s from Statistik Nord
'
%
identifier
)
else
:
count_known_dataset_ids
+=
1
except
Exception
,
e
:
except
Exception
,
e
:
log
.
error
(
'
traceback: %s
'
%
traceback
.
format_exc
())
log
.
error
(
'
traceback: %s
'
%
traceback
.
format_exc
())
...
@@ -97,6 +100,10 @@ class StatistikamtNordHarvester(ODSHBaseHarvester):
...
@@ -97,6 +100,10 @@ class StatistikamtNordHarvester(ODSHBaseHarvester):
log
.
info
(
"
finished %s IDs of %s IDs successfully gathered
"
%
(
len
(
used_identifiers
),
len
(
documents
)))
log
.
info
(
"
finished %s IDs of %s IDs successfully gathered
"
%
(
len
(
used_identifiers
),
len
(
documents
)))
log
.
debug
(
"
gather_stage() finished: %s IDs gathered
"
%
len
(
ids
))
log
.
debug
(
"
gather_stage() finished: %s IDs gathered
"
%
len
(
ids
))
return
ids
return
ids
elif
count_known_dataset_ids
>
0
:
log
.
info
(
"
Gathered
"
+
str
(
count_known_dataset_ids
)
+
"
datasets already stored in the database. No new datasets found.
"
)
return
[]
else
:
else
:
log
.
error
(
"
No records received
"
)
log
.
error
(
"
No records received
"
)
self
.
_save_gather_error
(
"
Couldn
'
t find any metadata files
"
,
harvest_job
)
self
.
_save_gather_error
(
"
Couldn
'
t find any metadata files
"
,
harvest_job
)
...
...
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