Skip to content

Commit

Permalink
Fix gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
renan-souza committed Dec 9, 2024
1 parent cd8f057 commit d307a11
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/run-tests-simple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
env:
MONGO_ENABLED: false
timeout-minutes: 40
timeout-minutes: 60
if: "!contains(github.event.head_commit.message, 'CI Bot')"

steps:
Expand All @@ -33,9 +33,14 @@ jobs:
- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install default dependencies and run simple test
- name: Install basic deps
run: pip install .

- name: Check dbs utilization
run: python -c "from flowcept.configs import MONGO_ENABLED, LMDB_ENABLED; print('MONGO?', MONGO_ENABLED); print('LMDB?', LMDB_ENABLED)"

- name: Run simple test
run: |
pip install .
python examples/simple_instrumented_script.py | tee output.log
cat output.log
grep -q "ERROR" output.log && exit 1
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
env:
MONGO_ENABLED: true
LMDB_ENABLED: false
timeout-minutes: 40
timeout-minutes: 60
if: "!contains(github.event.head_commit.message, 'CI Bot')"

steps:
Expand All @@ -34,13 +34,19 @@ jobs:
- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install default dependencies and run simple test
- name: Install basic deps
run: pip install .[mongo]

- name: Check dbs utilization
run: python -c "from flowcept.configs import MONGO_ENABLED, LMDB_ENABLED; print('MONGO?', MONGO_ENABLED); print('LMDB?', LMDB_ENABLED)"

- name: Run simple test
run: |
pip install .[mongo]
python examples/simple_instrumented_script.py | tee output.log
cat output.log
grep -q "ERROR" output.log && exit 1
rm output.log

- name: Install Dask dependencies alone and run a simple Dask test
run: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ tests-in-container-mongo:
docker run --rm -v $(shell pwd):/flowcept -e KVDB_HOST=flowcept_redis -e MQ_HOST=flowcept_redis -e MONGO_HOST=flowcept_mongo --network flowcept_default flowcept /opt/conda/envs/flowcept/bin/pytest --ignore=tests/decorator_tests/ml_tests

tests-in-container:
docker run --rm -v $(shell pwd):/flowcept -e KVDB_HOST=flowcept_redis -e MQ_HOST=flowcept_redis -e MONGO_ENABLED=false --network flowcept_default flowcept /opt/conda/envs/flowcept/bin/pytest --ignore=tests/decorator_tests/ml_tests
docker run --rm -v $(shell pwd):/flowcept -e KVDB_HOST=flowcept_redis -e MQ_HOST=flowcept_redis -e MONGO_ENABLED=false -e LMDB_ENABLED=true --network flowcept_default flowcept /opt/conda/envs/flowcept/bin/pytest --ignore=tests/decorator_tests/ml_tests

# This command can be removed once we have our CLI
liveness:
Expand Down
14 changes: 8 additions & 6 deletions src/flowcept/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@
_mongo_settings = DATABASES.get("mongodb", None)
MONGO_ENABLED = False
if _mongo_settings:
MONGO_ENABLED = (
os.environ.get("MONGO_ENABLED", "false").lower() == "true"
) or _mongo_settings.get("enabled")
if "MONGO_ENABLED" in os.environ:
MONGO_ENABLED = (os.environ.get("MONGO_ENABLED").lower() == "true")
else:
MONGO_ENABLED = _mongo_settings.get("enabled", False)
MONGO_URI = os.environ.get("MONGO_URI") or _mongo_settings.get("uri")
MONGO_HOST = os.environ.get("MONGO_HOST") or _mongo_settings.get("host", "localhost")
MONGO_PORT = int(os.environ.get("MONGO_PORT") or _mongo_settings.get("port", 27017))
Expand All @@ -98,9 +99,10 @@
_lmdb_settings = DATABASES.get("lmdb", None)
LMDB_ENABLED = False
if _lmdb_settings:
LMDB_ENABLED = (
os.environ.get("LMDB_ENABLED", "false").lower() == "true"
) or _lmdb_settings.get("enabled", False)
if "LMDB_ENABLED" in os.environ:
LMDB_ENABLED = (os.environ.get("LMDB_ENABLED").lower() == "true")
else:
LMDB_ENABLED = _lmdb_settings.get("enabled", False)

##########################
# Buffer Settings #
Expand Down

0 comments on commit d307a11

Please sign in to comment.