Skip to content

Conversation

@jmchilton
Copy link
Member

I don't really think this will fix the problem - this seems like a deep bug in Galaxy to me but it might be worth attempting. The two things I did here is wait on the testing initial condition (the job search can find the job before we delete the dataset) in case there is a race condition of some sort and then use the more precise dataset deletion route in case there is a clash between collections and datasets. I think we defer to the dataset so this second thing probably won't help but I think the more precise endpoint simplifies the test and ensures this isn't the problem.

The error:

=================================== FAILURES ===================================
__________________ TestJobsApi.test_search_delete_hdca_output __________________

self = <galaxy_test.api.test_jobs.TestJobsApi object at 0x7f1c8c4c7160>
history_id = '3fac04e22af259c6'

    @pytest.mark.require_new_history
    def test_search_delete_hdca_output(self, history_id):
        list_id_a = self.__history_with_ok_collection(collection_type="list", history_id=history_id)
        inputs = json.dumps(
            {
                "input1": {"src": "hdca", "id": list_id_a},
            }
        )
        tool_response = self._job_search(tool_id="collection_creates_list", history_id=history_id, inputs=inputs)
        output_id = tool_response.json()["outputs"][0]["id"]
        # We delete a single tool output, no job should be returned
        delete_respone = self._delete(f"histories/{history_id}/contents/{output_id}")
        self._assert_status_code_is(delete_respone, 200)
        search_payload = self._search_payload(history_id=history_id, tool_id="collection_creates_list", inputs=inputs)
        self._search(search_payload, expected_search_count=0)
>       tool_response = self._job_search(tool_id="collection_creates_list", history_id=history_id, inputs=inputs)

delete_respone = <Response [200]>
history_id = '3fac04e22af259c6'
inputs     = '{"input1": {"src": "hdca", "id": "c34129969476e859"}}'
list_id_a  = 'c34129969476e859'
output_id  = '6a392b789966ae78'
search_payload = {'history_id': '3fac04e22af259c6',
 'inputs': '{"input1": {"src": "hdca", "id": "c34129969476e859"}}',
 'state': 'ok',
 'tool_id': 'collection_creates_list'}
self       = <galaxy_test.api.test_jobs.TestJobsApi object at 0x7f1c8c4c7160>
tool_response = <Response [200]>

lib/galaxy_test/api/test_jobs.py:869: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
lib/galaxy_test/api/test_jobs.py:1143: in _job_search
    self._search(search_payload, expected_search_count=1)
        empty_search_response = <Response [200]>
        history_id = '3fac04e22af259c6'
        inputs     = '{"input1": {"src": "hdca", "id": "c34129969476e859"}}'
        search_payload = {'history_id': '3fac04e22af259c6',
 'inputs': '{"input1": {"src": "hdca", "id": "c34129969476e859"}}',
 'state': 'ok',
 'tool_id': 'collection_creates_list'}
        self       = <galaxy_test.api.test_jobs.TestJobsApi object at 0x7f1c8c4c7160>
        tool_id    = 'collection_creates_list'
        tool_response = <Response [200]>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <galaxy_test.api.test_jobs.TestJobsApi object at 0x7f1c8c4c7160>
payload = {'history_id': '3fac04e22af259c6', 'inputs': '{"input1": {"src": "hdca", "id": "c34129969476e859"}}', 'state': 'ok', 'tool_id': 'collection_creates_list'}
expected_search_count = 1

    def _search(self, payload, expected_search_count=1):
        # in case job and history aren't updated at exactly the same
        # time give time to wait
        for _ in range(5):
            search_count = self._search_count(payload)
            if search_count == expected_search_count:
                break
            time.sleep(1)
>       assert (
            search_count == expected_search_count
        ), f"expected to find {expected_search_count} jobs, got {search_count} jobs"
E       AssertionError: expected to find 1 jobs, got 0 jobs
E       assert 0 == 1

_          = 4
expected_search_count = 1
payload    = {'history_id': '3fac04e22af259c6',
 'inputs': '{"input1": {"src": "hdca", "id": "c34129969476e859"}}',
 'state': 'ok',
 'tool_id': 'collection_creates_list'}
search_count = 0
self       = <galaxy_test.api.test_jobs.TestJobsApi object at 0x7f1c8c4c7160>

lib/galaxy_test/api/test_jobs.py:1158: AssertionError

https://github.com/jmchilton/galaxy/actions/runs/17649451626/job/50156222351

How to test the changes?

(Select all options that apply)

  • This is a refactoring of components with existing test coverage.

License

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

@jmchilton jmchilton changed the title Attempt to fix transient API test failures. Attempt to fix transient API test failure for jobs search. Sep 11, 2025
Copy link
Member

@jdavcs jdavcs left a comment

Choose a reason for hiding this comment

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

It seems to be worth a try? Let's merge and see if it continues to fail intermittently?

@mvdbeek
Copy link
Member

mvdbeek commented Sep 12, 2025

wait a moment, I think I found the exact issue (we're doing a cross join where we don't want that ...)

@jmchilton jmchilton marked this pull request as ready for review September 15, 2025 19:03
@github-actions github-actions bot added this to the 25.1 milestone Sep 15, 2025
I don't really think this will fix the problem - this seems like a deep bug in Galaxy to me but it might be worth attempting. The two things I did here is wait on the testing initial condition (the job search can find the job before we delete the dataset) in case there is a race condition of some sort and then use the more percise dataset deletion route in case there is a clash between collections and datasets. I think we defer to the dataset so this second thing probably won't help but I think the more percise endpoint simplifies the test and ensures this isn't the problem.
@jmchilton jmchilton merged commit aa67b87 into galaxyproject:dev Oct 14, 2025
52 of 58 checks passed
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.

3 participants