fix tests problems
This commit is contained in:
parent
556136d71d
commit
19b737fa5b
|
@ -206,18 +206,18 @@ def job_abort(ctx, id):
|
|||
"-e",
|
||||
"--exclude",
|
||||
default=False,
|
||||
help="""If source_id provided as excluded, all sources failed jobs, except for that
|
||||
help="""If source_id provided as excluded, all sources failed jobs, except for that
|
||||
will be aborted. You can use comma as a separator to provide multiple source_id's""",
|
||||
)
|
||||
@click.pass_context
|
||||
def abort_failed_jobs(ctx, life_span, include, exclude):
|
||||
"""Abort all jobs which are in a "limbo state" where the job has
|
||||
run with errors but the harvester run command will not mark it
|
||||
run with errors but the harvester run command will not mark it
|
||||
as finished, and therefore you cannot run another job.
|
||||
"""
|
||||
flask_app = ctx.meta["flask_app"]
|
||||
with flask_app.test_request_context():
|
||||
result = abort_failed_jobs(job_life_span, include, exclude)
|
||||
result = utils.abort_failed_jobs(life_span, include, exclude)
|
||||
click.echo(result)
|
||||
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class Harvester(CkanCommand):
|
|||
|
||||
harvester abort_failed_jobs {job_life_span} [--include={source_id}] [--exclude={source_id}]
|
||||
- abort all jobs which are in a "limbo state" where the job has
|
||||
run with errors but the harvester run command will not mark it
|
||||
run with errors but the harvester run command will not mark it
|
||||
as finished, and therefore you cannot run another job.
|
||||
|
||||
job_life_span determines from what moment
|
||||
|
@ -184,7 +184,7 @@ class Harvester(CkanCommand):
|
|||
"--exclude",
|
||||
dest="exclude_sources",
|
||||
default=False,
|
||||
help="""If source_id provided as excluded, all sources failed jobs, except for that
|
||||
help="""If source_id provided as excluded, all sources failed jobs, except for that
|
||||
will be aborted. You can use comma as a separator to provide multiple source_id's""",
|
||||
)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import json
|
||||
|
||||
import datetime
|
||||
import pytest
|
||||
|
||||
from ckan import plugins as p
|
||||
|
@ -473,7 +473,7 @@ class TestActions():
|
|||
assert job.status == 'Running'
|
||||
assert job.source_id == source.id
|
||||
assert 'Aborted jobs: 0' in result
|
||||
|
||||
|
||||
def test_harvest_abort_failed_jobs_with_unknown_frequency(self):
|
||||
# prepare
|
||||
data_dict = SOURCE_DICT.copy()
|
||||
|
@ -490,9 +490,9 @@ class TestActions():
|
|||
context = {'model': model, 'session': model.Session,
|
||||
'ignore_auth': True, 'user': ''}
|
||||
|
||||
with pytest.raises(Exception) as e:
|
||||
toolkit.get_action('harvest_abort_failed_jobs')(
|
||||
context, {'life_span': 3})
|
||||
with pytest.raises(Exception):
|
||||
get_action('harvest_abort_failed_jobs')(
|
||||
context, {'life_span': 3})
|
||||
|
||||
def test_harvest_source_create_twice_with_unique_url(self):
|
||||
data_dict = SOURCE_DICT.copy()
|
||||
|
|
Loading…
Reference in New Issue