Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
ab3807be
Commit
ab3807be
authored
Oct 08, 2015
by
LE GAC Renaud
Browse files
Execute one harvesters works with multiple stores.
parent
30d8eb6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
18 deletions
+27
-18
controllers/harvest.py
controllers/harvest.py
+27
-18
No files found.
controllers/harvest.py
View file @
ab3807be
...
...
@@ -308,24 +308,31 @@ def run():
selector
=
Selector
(
virtdb
.
harvester_selector
,
exclude_fields
=
(
'mode'
,
'year_start'
,
'year_end'
))
# Get
the
host and collections
row
=
selector
.
select
(
db
.
harvesters
)
.
first
()
if
not
row
:
# Get host
s
and collections
row
s
=
selector
.
select
(
db
.
harvesters
)
if
not
row
s
:
raise
ToolException
(
MSG_NO_HARVESTER
)
tool
=
build_harvester_tool
(
db
,
selector
.
id_teams
,
selector
.
id_projects
,
selector
.
controller
,
row
.
harvesters
.
id_categories
,
year_start
=
selector
.
year_start
,
year_end
=
selector
.
year_end
,
dry_run
=
(
selector
.
mode
==
MODE_DRY_RUN
),
debug
=
False
)
if
not
tool
:
return
INLINE_ALERT
%
(
T
(
'Error'
),
T
(
'Select an harvester.'
))
collection_logs
=
[]
logs
=
[]
for
row
in
rows
:
tool
=
build_harvester_tool
(
db
,
selector
.
id_teams
,
selector
.
id_projects
,
selector
.
controller
,
row
.
harvesters
.
id_categories
,
year_start
=
selector
.
year_start
,
year_end
=
selector
.
year_end
,
dry_run
=
(
selector
.
mode
==
MODE_DRY_RUN
),
debug
=
False
)
if
not
tool
:
return
INLINE_ALERT
%
(
T
(
'Error'
),
T
(
'Select an harvester.'
))
tool
.
process_url
(
row
.
harvesters
.
host
,
row
.
harvesters
.
collections
)
tool
.
process_url
(
row
.
harvesters
.
host
,
row
.
harvesters
.
collections
)
collection_logs
.
extend
(
tool
.
collection_logs
)
logs
.
extend
(
tool
.
logs
)
except
ToolException
as
e
:
return
T
(
str
(
e
))
...
...
@@ -336,10 +343,12 @@ def run():
msg
+=
'<hr/>'
return
msg
# delegate rendering to the report view
response
.
view
=
'harvest/layout.%s'
%
request
.
extension
report
=
tool
.
report
()
report
[
'selector'
]
=
selector
return
report
return
dict
(
collection_logs
=
collection_logs
,
controller
=
selector
.
controller
,
logs
=
logs
,
selector
=
selector
)
def
run_all
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment