Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[22.05] Add missing celery dep to galaxy test base #15205

Open
wants to merge 4 commits into
base: release_22.05
Choose a base branch
from

Conversation

nuwang
Copy link
Member

@nuwang nuwang commented Dec 13, 2022

I was seeing this error as a result of the missing celery dependency:

_______________________________________________________________________________________ TestMapperResubmission.test_mapping_without_resubmission _______________________________________________________________________________________
file /Users/nuwan/work/total-perspective-vortex/tests/test_mapper_resubmit.py, line 38
      def test_mapping_without_resubmission(self):
file /Users/nuwan/work/total-perspective-vortex/.tox/py3.10/lib/python3.8/site-packages/galaxy_test/base/api.py, line 52
      @pytest.fixture(autouse=True, scope="session")
      def _request_celery_app(self, celery_session_app, celery_config):
E       fixture 'celery_session_app' not found
>       available fixtures: _request_celery_app, _request_celery_worker, _unittest_setUpClass_fixture_TestMapperResubmission, anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, celery_parameters, celery_worker_parameters, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

It turned out that the celery_session_app fixture is coming from the celery app, which is not a declared dependency of galaxy_test_base.

Fixing that results in the next error:

self = <tests.test_mapper_resubmit.TestMapperResubmission testMethod=test_mapping_with_resubmission>, celery_session_app = <Celery celery.tests at 0x124fa6fd0>, celery_config = {}

    @pytest.fixture(autouse=True, scope="session")
    def _request_celery_app(self, celery_session_app, celery_config):
        try:
            self._celery_app = celery_session_app
            yield
        finally:
            if os.environ.get("GALAXY_TEST_EXTERNAL") is None:
                from galaxy.celery import celery_app

>               celery_app.fork_pool.stop()
E               AttributeError: 'Celery' object has no attribute 'fork_pool'

For which I've added the conditional stop. Why it's null in the first place, I don't know.

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@@ -58,8 +58,9 @@ def _request_celery_app(self, celery_session_app, celery_config):
if os.environ.get("GALAXY_TEST_EXTERNAL") is None:
from galaxy.celery import celery_app

celery_app.fork_pool.stop()
celery_app.fork_pool.join(timeout=5)
if celery_app.fork_pool:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems weird, are you bootstrapping your own instance or targeting an external one ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just subclasses integration test case: https://github.com/galaxyproject/total-perspective-vortex/blob/main/tests/test_mapper_resubmit.py
No other setup as such. Is anything else required?

@mvdbeek mvdbeek changed the title Add missing celery dep to galaxy test base [22.05] Add missing celery dep to galaxy test base Dec 13, 2022
Copy link
Member

@mvdbeek mvdbeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I guess we'll have to do this, but maybe we should actually spin up a real, separate celery instance in the driver, so we can get rid of this.

@jmchilton
Copy link
Member

Is it possible to move all of this to galaxy_test.driver? galaxy_test.base shouldn't have backend details like this in it.

Co-authored-by: Marius van den Beek <[email protected]>
@nuwang
Copy link
Member Author

nuwang commented Dec 21, 2022

@mvdbeek Is this ok to be merged? It would help with getting the resubmission integration tests running for TPV.

@nuwang
Copy link
Member Author

nuwang commented Aug 31, 2023

This is no longer an issue with packaged point releases, so I'll close this.

@nuwang nuwang closed this Aug 31, 2023
@nuwang nuwang reopened this Nov 14, 2023
@nuwang
Copy link
Member Author

nuwang commented Nov 14, 2023

@nsoranzo
Copy link
Member

LGTM. Do you still need to target 22.05 or would 23.0 be enough?

@@ -42,6 +42,7 @@ install_requires =
pytest
PyYAML
requests
pytest-celery
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since commit 1fef07c we are not using pytest-celery any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants