Scheduler added
This commit is contained in:
+13
-7
@@ -16,7 +16,7 @@ import argparse
|
||||
import dotenv
|
||||
import os
|
||||
import pandas as pd
|
||||
|
||||
import time
|
||||
import urllib3
|
||||
import utils.allowlist
|
||||
import utils.clientfunctions
|
||||
@@ -27,6 +27,7 @@ import utils.pathfunctions
|
||||
import utils.policyfunctions
|
||||
import utils.pretty as ct
|
||||
|
||||
from utils.perstscheduler import register_function, run_once_job, recurring_job, reload_jobs, start_scheduler
|
||||
|
||||
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
@@ -51,15 +52,20 @@ def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.monitorOTP:
|
||||
|
||||
|
||||
# Non-interactive logic
|
||||
if not os.path.exists("parquet"): os.makedirs("parquet")
|
||||
# Non-interactive logic
|
||||
if not os.path.exists("scheduling"): os.makedirs("scheduling")
|
||||
if not os.path.exists("OTP"): os.makedirs("OTP")
|
||||
if not os.path.exists("OTP\\HTML"): os.mkdir("OTP\\HTML")
|
||||
if not os.path.exists("OTP\\PARQ"): os.mkdir("OTP\\PARQ")
|
||||
apivalidation()
|
||||
print(f"Running non-interactively to start monitoring OTP")
|
||||
register_function("monitorOTP", utils.otpfunctions.monitorOTP)
|
||||
|
||||
if not os.path.exists("scheduling\\jobs.json"): recurring_job("monitor", "monitorOTP", interval=60, unit="seconds", args=[url])
|
||||
else:
|
||||
reload_jobs()
|
||||
start_scheduler()
|
||||
|
||||
|
||||
# Process input here
|
||||
else:
|
||||
# Interactive logic
|
||||
apivalidation()
|
||||
|
||||
Reference in New Issue
Block a user