mirror of
https://github.com/quatalog/quatalog.git
synced 2024-11-22 14:52:54 +00:00
Add debug timeout to workflow
This commit is contained in:
parent
b304e9f8d2
commit
4916feeb19
16
.github/workflows/transfer.yml
vendored
16
.github/workflows/transfer.yml
vendored
|
@ -1,8 +1,14 @@
|
|||
name: Scrape transfer and update file
|
||||
on:
|
||||
# schedule:
|
||||
# - cron: '15 * * * *'
|
||||
workflow_dispatch:
|
||||
# schedule:
|
||||
# - cron: '15 * * * *'
|
||||
inputs:
|
||||
timeout:
|
||||
description: "Timeout time"
|
||||
required: true
|
||||
type: number
|
||||
default: 120
|
||||
concurrency:
|
||||
group: transfer-scraper
|
||||
|
||||
|
@ -39,7 +45,7 @@ jobs:
|
|||
|
||||
- name: Scrape transfer guide
|
||||
run: |
|
||||
python3 quatalog-scraping/transfer_scraper/main.py data/transfer.json data/transfer_state.json
|
||||
python3 quatalog-scraping/transfer_scraper/main.py data/transfer.json data/transfer_state.json ${{ github.event.inputs.timeout }}
|
||||
|
||||
- name: Upload data to artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
|
@ -53,14 +59,14 @@ jobs:
|
|||
needs: [scrape-data]
|
||||
steps:
|
||||
- name: Clone Quatalog data
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: quatalog/data
|
||||
path: quatalog-data
|
||||
token: ${{ secrets.PUSH_TOKEN }}
|
||||
|
||||
- name: Download data from artifact
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: transfer-data
|
||||
path: data/
|
||||
|
|
|
@ -101,12 +101,17 @@ def scrape_course_card(html_id, i, note):
|
|||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 3:
|
||||
print(f"USAGE: python {sys.argv[0]} <transfer file> <state file>")
|
||||
if len(sys.argv) != 4:
|
||||
print(f"USAGE: python {sys.argv[0]} <transfer file> <state file> <timeout minutes>")
|
||||
exit(1)
|
||||
|
||||
transfer_json_path = sys.argv[1]
|
||||
state_json_path = sys.argv[2]
|
||||
timeout_seconds = int(sys.argv[3]) * 60
|
||||
|
||||
# Set up timeout so that the GH action does not run forever, pretend it's ^C
|
||||
signal(SIGALRM, lambda a, b: raise_(KeyboardInterrupt))
|
||||
alarm(timeout_seconds)
|
||||
|
||||
options = webdriver.FirefoxOptions()
|
||||
user_agent = UserAgent().random
|
||||
|
@ -137,10 +142,6 @@ def main():
|
|||
json.dump(state, sys.stderr, indent=4)
|
||||
print("", file=sys.stderr)
|
||||
|
||||
# Set up 2hr timeout so that the GH action does not run forever, pretend it's ^C
|
||||
signal(SIGALRM, lambda a, b: raise_(KeyboardInterrupt))
|
||||
alarm(60 * 60 * 2)
|
||||
|
||||
try:
|
||||
curr_page = 1
|
||||
while state["inst_pg"] <= num_pages:
|
||||
|
|
Loading…
Reference in a new issue