I was able to solve this by using the subprocess module in a separate .py file. Basically, I have a new .py file that acts as the manager for the task I really want to run:
proc = subprocess.run(["python", "generate_events.py"], stdout=subprocess.PIPE, timeout=60*15)
print('Process ran too long and was killed.')
Then I call the above .py from the Task management UI. If the task runs for longer than 15 minutes, it will raise the timeout exception and automatically quit. I need to add some logging about what the subprocess actually did while it ran before it timed out, but for now this is enough.
NOTE: I actually had to modify the paths of the two args input into the subprocess to match my former inputs into the Task management UI. Since I was running the original task from a virtualenv and I was running a .py file from deep within my directory structure, I had to modify the path on both the python call and the script so the subprocess could find them both.