Skip to content

Commit

Permalink
Merge branch 'master' into sarc-383-download-slurm-conf-files
Browse files Browse the repository at this point in the history
  • Loading branch information
nurbal authored Jan 16, 2025
2 parents e2a0324 + 521efb7 commit af97921
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:

- name: Install MongoDB
run: |
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | gpg --dearmor | sudo tee /usr/share/keyrings/mongodb.gpg > /dev/null
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
mongod --version
Expand Down
16 changes: 15 additions & 1 deletion sarc/cli/health/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import gifnoc

from sarc.alerts.common import config
from sarc.alerts.common import CheckStatus, config
from sarc.alerts.runner import CheckRunner

logger = logging.getLogger(__name__)
Expand All @@ -14,18 +14,32 @@
@dataclass
class HealthCheckCommand:
config: Path = None
once: bool = False

name: str = None

def execute(self) -> int:
with gifnoc.use(self.config):
if self.name:
# only run one check, once (no CheckRunner)
check = config.checks[self.name]
results = check(write=False)
pprint(results)
for k, status in results.statuses.items():
print(f"{status.name} -- {k}")
print(f"{results.status.name}")
elif self.once:
# run all checks, once (no CheckRunner)
for check in [c for c in config.checks.values() if c.active]:
results = check(write=False)
if results.status == CheckStatus.OK:
print(f"Check '{check.name}' succeeded.")
else:
print(f"Check '{check.name}' failed.")
pprint(results)
for k, status in results.statuses.items():
print(f"{status.name} -- {k}")
print(f"{results.status.name}")
else:
try:
runner = CheckRunner(
Expand Down

0 comments on commit af97921

Please sign in to comment.