-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #199 from ORNL/ml_epochs
Ml epochs
- Loading branch information
Showing
34 changed files
with
608 additions
and
219 deletions.
There are no files selected for viewing
22 changes: 9 additions & 13 deletions
22
.github/workflows/run-checks.yml → .github/workflows/checks.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: LLM Tests | ||
on: [pull_request] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ "3.10", "3.11", "3.12" ] | ||
env: | ||
MONGO_ENABLED: true | ||
LMDB_ENABLED: false | ||
timeout-minutes: 60 | ||
if: "!contains(github.event.head_commit.message, 'CI Bot')" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "pip" | ||
|
||
- name: Show OS Info | ||
run: '[[ "$OSTYPE" == "linux-gnu"* ]] && { echo "OS Type: Linux"; (command -v lsb_release &> /dev/null && lsb_release -a) || cat /etc/os-release; uname -r; } || [[ "$OSTYPE" == "darwin"* ]] && { echo "OS Type: macOS"; sw_vers; uname -r; } || echo "Unsupported OS type: $OSTYPE"' | ||
|
||
- name: Start docker compose with redis | ||
run: make services-mongo | ||
|
||
- name: Upgrade pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
python --version | ||
- name: Test LLM | ||
run: bash .github/workflows/run_examples.sh examples true llm_complex/llm_test_runner.py | ||
|
||
- name: Shut down docker compose | ||
run: make services-stop-mongo | ||
|
||
- name: Clean up | ||
run: | | ||
make clean | ||
find /home/runner/runners/ -type f -name "*.log" -exec sh -c 'echo {}; >"{}"' \; || true | ||
docker image prune -a -f | ||
- name: List large files | ||
run: find . -type f -exec du -h {} + | sort -h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import os | ||
import subprocess | ||
import uuid | ||
from time import sleep | ||
from flowcept import Flowcept, FlowceptTask | ||
|
||
def execute_cmd(command: str) -> int: | ||
""" | ||
Executes a command using nohup in the background and returns the process ID (PID). | ||
Parameters | ||
---------- | ||
command : str | ||
The command to be executed. | ||
Returns | ||
------- | ||
int | ||
The PID of the background process. | ||
""" | ||
try: | ||
# Append nohup and redirect outputs to /dev/null for background execution | ||
nohup_command = f"nohup {command} > /dev/null 2>&1 & echo $!" | ||
# Execute the command in a shell and capture the PID | ||
print(f"Executing: {nohup_command}") | ||
process = subprocess.run(nohup_command, shell=True, check=True, executable='/bin/bash', text=True, capture_output=True) | ||
pid = int(process.stdout.strip()) # Get the PID from the output | ||
print(f"Started process with PID: {pid}") | ||
return pid | ||
except subprocess.CalledProcessError as e: | ||
print(f"Error executing command: {command}\n{e}") | ||
return -1 | ||
|
||
|
||
def kill_process(pid: int) -> None: | ||
""" | ||
Kills a process by its PID. | ||
Parameters | ||
---------- | ||
pid : int | ||
The PID of the process to be killed. | ||
""" | ||
try: | ||
os.kill(pid, 9) # Send SIGKILL to the process | ||
print(f"Process {pid} killed successfully.") | ||
except ProcessLookupError: | ||
print(f"No process found with PID: {pid}.") | ||
except PermissionError: | ||
print(f"Permission denied to kill PID: {pid}.") | ||
|
||
|
||
def simple_flowcept_task(workflow_id): | ||
|
||
with Flowcept(start_persistence=False, workflow_id=workflow_id, bundle_exec_id=workflow_id): | ||
with FlowceptTask(used={"a": 1}) as t: | ||
t.end(generated={"b": 2}) | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
workflow_id = str(uuid.uuid4()) | ||
print(workflow_id) | ||
|
||
pid = execute_cmd(f"python -c 'from flowcept import Flowcept; Flowcept.start_consumption_services(\"{workflow_id}\")'") | ||
sleep(1) | ||
|
||
simple_flowcept_task(workflow_id) | ||
|
||
sleep(15) # Give enough time for the consumer services to do their thing | ||
|
||
kill_process(pid) | ||
|
||
tasks = Flowcept.db.query({"workflow_id": workflow_id}) | ||
assert len(tasks) == 1 | ||
print(tasks) |
Oops, something went wrong.