Skip to content

CI: flaky tests on windows #240

Description

@woutdenolf

https://github.com/ewoks-kit/ewoksserver/actions/runs/22774193380/job/66063124721

__________________ test_get_execution_events_parallel[/api] ___________________

local_exec_client = (<starlette.testclient.TestClient object at 0x0000017A955E7370>, <ewoksserver.tests.socketio_test.SocketIOTestClient object at 0x0000017A939CB430>)
api_root = '/api'

    def test_get_execution_events_parallel(local_exec_client, api_root):
        client, sclient = local_exec_client
    
        _, expected = get_graph("demo")
        nevents = 0
        nevents_per_exec = 2 * (len(expected) + 2)
    
        # Test no events (nothing has been executed)
        jobs = client.get(f"{api_root}/execution/events").json()["jobs"]
        assert not jobs
    
        # Execute workflows in parallel
        nruns = 3
        for _ in range(nruns):
            response = client.post(
                f"{api_root}/execute/demo",
                json={"execute_arguments": {"inputs": [{"name": "delay", "value": 0.1}]}},
            )
            data = response.json()
            assert response.status_code == 200, data
            nevents += nevents_per_exec
    
        # Get events from Socket.IO and REST API
>       events_socketio = get_events(api_root, sclient, nevents)

src\ewoksserver\tests\test_events.py:126: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

api_root = '/api'
sclient = <ewoksserver.tests.socketio_test.SocketIOTestClient object at 0x0000017A939CB430>
nevents = 54, timeout = 10

    def get_events(api_root, sclient, nevents, timeout=10):
        t0 = time.time()
        events = list()
        while True:
            for event in sclient.get_events():
                if "/v1" in api_root and "engine" in event_utils.FIELD_TYPES:
                    event["binding"] = event.pop("engine")
                events.append(event)
            if len(events) == nevents:
                break
            time.sleep(0.1)
            if time.time() - t0 > timeout:
>               raise TimeoutError(f"Received {len(events)} instead of {nevents}")
E               TimeoutError: Received 52 instead of 54

src\ewoksserver\tests\test_execute.py:203: TimeoutError

Caused by sqlite3 error?

---------------------------- Captured stderr call -----------------------------
--- Logging error ---

Traceback (most recent call last):

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\ewoksutils\logging_utils\sqlite3.py", line 74, in _sql_query

    conn.execute(sql, parameters)

sqlite3.OperationalError: database is locked



The above exception was the direct cause of the following exception:



Traceback (most recent call last):

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\ewoksutils\logging_utils\connection.py", line 78, in emit

    self._send_serialized_record(s)

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\ewoksutils\logging_utils\sqlite3.py", line 52, in _send_serialized_record

    self._sql_query(self._insert_row_query, values)

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\ewoksutils\logging_utils\sqlite3.py", line 80, in _sql_query

    raise TimeoutError("cannot execute SQL query") from exception

TimeoutError: cannot execute SQL query

Call stack:

  File "<string>", line 1, in <module>

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\multiprocessing\spawn.py", line 116, in spawn_main

    exitcode = _main(fd, parent_sentinel)

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\multiprocessing\spawn.py", line 129, in _main

    return self._bootstrap(parent_sentinel)

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\multiprocessing\process.py", line 315, in _bootstrap

    self.run()

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\multiprocessing\process.py", line 108, in run

    self._target(*self._args, **self._kwargs)

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\concurrent\futures\process.py", line 246, in _process_worker

    r = call_item.fn(*call_item.args, **call_item.kwargs)

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\ewoks\bindings.py", line 80, in execute_graph

    self.handle(record)

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\logging\__init__.py", line 1599, in handle

    self.callHandlers(record)

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\logging\__init__.py", line 1661, in callHandlers

    hdlr.handle(record)

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\logging\__init__.py", line 952, in handle

    self.emit(record)

  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\ewoksutils\logging_utils\connection.py", line 80, in emit

    self.handleError(record)

Message: '[job %r] [workflow %r] [node %r] [task %r] %s'

Arguments: ('107390da-3cda-4548-99a2-4ba82a5e3b3a', 'demo', 'task1', 'ewokscore.tests.examples.tasks.sumtask.SumTask', 'task started')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions