Skip to content

Commit

Permalink
fix(tests): misc;
Browse files Browse the repository at this point in the history
- More attempts...
  • Loading branch information
JVickery-TBS committed Dec 9, 2024
1 parent 0ab5ef3 commit f4e6608
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
10 changes: 4 additions & 6 deletions ckanext/xloader/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,8 @@ def tabulator_load():
tmp_file.close()
except FileNotFoundError:
pass
timeout = config.get('ckanext.xloader.job_timeout', '3600')
logger.warning('Job timed out after %ss', timeout)
raise JobError('Job timed out after {}s'.format(timeout))
logger.warning('Job timed out after %ss', RETRIED_JOB_TIMEOUT)
raise JobError('Job timed out after {}s'.format(RETRIED_JOB_TIMEOUT))
except FileCouldNotBeLoadedError as e:
logger.warning('Loading excerpt for this format not supported.')
logger.error('Loading file raised an error: %s', e)
Expand Down Expand Up @@ -389,9 +388,8 @@ def _download_resource_data(resource, data, api_key, logger):
request_url=url, response=None)
except JobTimeoutException as e:
tmp_file.close()
timeout = config.get('ckanext.xloader.job_timeout', '3600')
logger.warning('Job timed out after %ss', timeout)
raise JobError('Job timed out after {}s'.format(timeout))
logger.warning('Job timed out after %ss', RETRIED_JOB_TIMEOUT)
raise JobError('Job timed out after {}s'.format(RETRIED_JOB_TIMEOUT))

logger.info('Downloaded ok - %s', printable_file_size(length))
file_hash = m.hexdigest()
Expand Down
6 changes: 3 additions & 3 deletions ckanext/xloader/tests/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def data(create_with_upload, apikey):


@pytest.mark.usefixtures("clean_db", "with_plugins")
@pytest.mark.ckan_config("ckanext.xloader.job_timeout", 15)
@pytest.mark.ckan_config("ckan.jobs.timeout", 15)
@pytest.mark.ckan_config("ckanext.xloader.job_timeout", 2)
@pytest.mark.ckan_config("ckan.jobs.timeout", 2)
class TestXLoaderJobs(helpers.FunctionalRQTestBase):

def test_xloader_data_into_datastore(self, cli, data):
Expand Down Expand Up @@ -139,7 +139,7 @@ def test_data_max_excerpt_lines_config(self, cli, data):

def test_data_with_rq_job_timeout(self, cli, data):
file_suffix = 'multiplication_2.csv'
self.enqueue(jobs.xloader_data_into_datastore, [data], rq_kwargs=dict(timeout=15))
self.enqueue(jobs.xloader_data_into_datastore, [data], rq_kwargs=dict(timeout=2))
with mock.patch("ckanext.xloader.jobs.get_response", get_large_data_response):
stdout = cli.invoke(ckan, ["jobs", "worker", "--burst"]).output
assert "Job timed out after" in stdout
Expand Down
4 changes: 2 additions & 2 deletions test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ handlers = console

[logger_ckan]
qualname = ckan
handlers =
handlers = console
level = INFO

[logger_ckanext_xloader]
qualname = ckanext.xloader
handlers =
handlers = console
level = WARN

[logger_sqlalchemy]
Expand Down

0 comments on commit f4e6608

Please sign in to comment.