Skip to content

Commit

Permalink
Fix loop test
Browse files Browse the repository at this point in the history
  • Loading branch information
renan-souza committed Dec 12, 2024
1 parent 44d4d2a commit 61ea297
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests-in-container.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests inside a Container
name: (With Mongo) Tests inside a Container
on: [pull_request]

jobs:
Expand Down
43 changes: 34 additions & 9 deletions .github/workflows/run-tests-kafka.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: All tests on Kafka MQ
name: (With Mongo) Tests on Kafka MQ
#on:
# pull_request:
# branches: [ "dev", "main" ]
Expand Down Expand Up @@ -27,17 +27,42 @@ jobs:
python-version: "3.10"
cache: "pip"

- name: Install package and dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[all]
python -m pip install .[ml_dev]
- name: Run docker compose
run: docker compose -f deployment/compose-kafka.yml up -d

- name: Wait for one minute
run: sleep 60
- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Show Python version
run: python --version && pip --version

- name: Install default dependencies and run simple test
run: |
pip install .
python examples/simple_instrumented_script.py
- name: Install Dask dependencies alone and run a simple Dask test
run: |
pip uninstall flowcept -y
pip install .[dask]
python examples/dask_example.py
- name: Install MLFlow dependencies alone and run a simple MLFlow test
run: |
pip uninstall flowcept -y
pip install .[mlflow]
python examples/mlflow_example.py
- name: Install Tensorboard dependencies alone and run a simple Tensorboard test
run: |
pip uninstall flowcept -y
pip install .[tensorboard]
python examples/tensorboard_example.py
- name: Install all dependencies
run: |
python -m pip install .[all]
python -m pip install .[ml_dev]
- name: Check liveness
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests-py11-all-dbs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests on py11 with and without Mongo
name: (With and Without Mongo) Tests on py11
on: [pull_request]

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests-py11-simple.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests on py11 without Mongo
name: (Without Mongo) Tests on py11
on: [pull_request]

jobs:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/run-tests-py11.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests on py11
name: (With Mongo) Tests on py11
on: [pull_request]

jobs:
Expand Down Expand Up @@ -59,7 +59,6 @@ jobs:
- name: Install all dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[all]
python -m pip install .[ml_dev]
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ jobs:
- name: Install all dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[all]
python -m pip install .[ml_dev]
Expand Down
14 changes: 10 additions & 4 deletions tests/decorator_tests/flowcept_task_decorator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,16 @@ def test_flowcept_loop_generator(self):

docs = Flowcept.db.query(filter={"workflow_id": Flowcept.current_workflow_id})
assert len(docs) == 3 # 1 (parent_task) + 2 (sub_tasks)
first_task = docs[0]
assert first_task["activity_id"] == "epochs"
sub_tasks = docs[1:]
assert all(t["parent_task_id"] == first_task["task_id"] for t in sub_tasks)

iteration_tasks = []
whole_loop_task = None
for d in docs:
if d["activity_id"] == "epochs":
whole_loop_task = d
else:
iteration_tasks.append(d)
assert len(iteration_tasks) == 2
assert all(t["parent_task_id"] == whole_loop_task["task_id"] for t in iteration_tasks)



Expand Down

0 comments on commit 61ea297

Please sign in to comment.