Commit ab3807be authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Execute one harvesters works with multiple stores.

parent 30d8eb6d
......@@ -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 hosts and collections
rows = selector.select(db.harvesters)
if not rows:
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():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment