Skip to content

Commit

Permalink
Add helper script to execute pytest on the dev server
Browse files Browse the repository at this point in the history
HEDWG2-1197
  • Loading branch information
annshress committed Jan 31, 2024
1 parent ce4b760 commit 0676b3b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions em_workflows/test_runner/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def run_tests(git_branch: str) -> str:

@flow(
name="Pytest Runner",
flow_run_name="Test-on-{git_branch}",
log_prints=True,
task_runner=Config.SLURM_EXECUTOR,
)
Expand Down
32 changes: 32 additions & 0 deletions helper_scripts/remote_pytest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

echo
if [[ ! $(prefect config view | grep PREFECT_API_KEY) ]]; then
echo "PREFECT_API_KEY is not set; Set using 'prefect config set PREFECT_API_KEY=*****'";
exit 1;
fi

branch=`git branch --show-current`
echo "Sending pytest runner for branch=$branch";
echo "Make sure you are connected to NIAID VPN";
echo

if [[ ! $(git branch -r | grep $branch) ]]; then
echo "Push the branch to remote before executing this action.";
echo
exit 1;
else
echo "Make sure the branch is up to date in remote"
echo
fi

run_id=$(curl -i -X POST \
"https://prefect2.hedwig-workflow-api.niaiddev.net/api/deployments/d87fc0e8-5c71-408a-bcbe-f2a6320686d1/create_flow_run" \
-H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $PREFECT_API_KEY" \
-d "{\"parameters\": {\"git_branch\":\"$branch\"}}" | \
sed -n 's/.*\([0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}\).*/\1/p')

flow="https://prefect2.hedwig-workflow-api.niaiddev.net/flow-runs/flow-run/$run_id"
echo
echo "Flow Run can be accessed here: $flow";
echo

0 comments on commit 0676b3b

Please sign in to comment.