diff --git a/.github/workflows/restart-jobs.yml b/.github/workflows/restart-jobs.yml new file mode 100644 index 000000000..49a2c51e8 --- /dev/null +++ b/.github/workflows/restart-jobs.yml @@ -0,0 +1,32 @@ +name: Restart Databricks Jobs + +on: + workflow_run: + workflows: ["Bump Version, Generate Changelog, Create Release, and Publish"] + types: + - completed + +jobs: + restart_jobs: + runs-on: ubuntu-latest + needs: combined_job + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Restart Databricks Jobs + run: | + echo "Getting list of jobs..." + JOB_LIST=$(curl -X GET -H "Authorization: Bearer ${{ secrets.SERVER_TOKEN }}" "https://${{ secrets.SERVER_DOMAIN }}/api/2.0/jobs/list") + echo "Jobs: $JOB_LIST" + + for JOB in $(echo "${JOB_LIST}" | jq -r '.jobs[].job_id'); do + JOB_INFO=$(curl -X GET -H "Authorization: Bearer ${{ secrets.SERVER_TOKEN }}" "https://${{ secrets.SERVER_DOMAIN }}/api/2.0/jobs/get?job_id=$JOB") + CLUSTER_NAME=$(echo "$JOB_INFO" | jq -r '.settings.new_cluster.cluster_name') + + if [ "$CLUSTER_NAME" = "Fastlane (v3)" ]; then + echo "Restarting job $JOB on cluster $CLUSTER_NAME..." + RESPONSE=$(curl -X POST -H "Authorization: Bearer ${{ secrets.SERVER_TOKEN }}" -d "{\"job_id\": $JOB}" "https://${{ secrets.SERVER_DOMAIN }}/api/2.0/jobs/run-now") + echo "Response: $RESPONSE" + fi + done diff --git a/resources/NBTest/NBTest_903_FlashloanTokens.py b/resources/NBTest/NBTest_903_FlashloanTokens.py index c3f7b740b..fe98a6659 100644 --- a/resources/NBTest/NBTest_903_FlashloanTokens.py +++ b/resources/NBTest/NBTest_903_FlashloanTokens.py @@ -83,7 +83,7 @@ def run_command(mode): # Wait for the expected log line to appear expected_log_line = "limiting flashloan_tokens to [" found = False - result = subprocess.run(cmd, text=True, capture_output=True, check=True) + result = subprocess.run(cmd, text=True, capture_output=True, check=True, timeout=120) # Check if the expected log line is in the output if expected_log_line in result.stderr: diff --git a/resources/NBTest/NBTest_904_Bancor3DataValidation.py b/resources/NBTest/NBTest_904_Bancor3DataValidation.py index cb0dee142..b1c10e073 100644 --- a/resources/NBTest/NBTest_904_Bancor3DataValidation.py +++ b/resources/NBTest/NBTest_904_Bancor3DataValidation.py @@ -79,7 +79,7 @@ def run_command(arb_mode, expected_log_line): # Wait for the expected log line to appear found = False - result = subprocess.run(cmd, text=True, capture_output=True, check=True, timeout=60) + result = subprocess.run(cmd, text=True, capture_output=True, check=True, timeout=120) # Check if the expected log line is in the output if expected_log_line in result.stderr: diff --git a/resources/NBTest/NBTest_905_RespectMinProfitClickParam.py b/resources/NBTest/NBTest_905_RespectMinProfitClickParam.py index 489abc1fe..f733b94b7 100644 --- a/resources/NBTest/NBTest_905_RespectMinProfitClickParam.py +++ b/resources/NBTest/NBTest_905_RespectMinProfitClickParam.py @@ -80,7 +80,7 @@ def run_command(arb_mode, expected_log_line): # Wait for the expected log line to appear found = False - result = subprocess.run(cmd, text=True, capture_output=True, check=True, timeout=60) + result = subprocess.run(cmd, text=True, capture_output=True, check=True, timeout=120) # Check if the expected log line is in the output if expected_log_line in result.stderr or expected_log_line in result.stdout: