-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscheduler.py
More file actions
28 lines (22 loc) · 951 Bytes
/
scheduler.py
File metadata and controls
28 lines (22 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
import os
# Check if this code is running on Heroku. The easiest way is to tell is by
# the existence of an environment variable called `DYNO`.
if os.getenv('DYNO'):
# Newrelic has to be imported before any flask code is imported.
import newrelic.agent
newrelic.agent.initialize('newrelic.ini', 'scheduler')
import argparse
from yoapi.factory.scheduler import create_scheduler_app
from yoapi.services.scheduler import yo_scheduler
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='YoAPI console server.')
parser.add_argument('--config', dest='config',
default='yoapi.config.Default',
help='Dotted module path of config class.')
args = parser.parse_args()
app = create_scheduler_app(name='scheduler', config=args.config)
with app.app_context():
yo_scheduler.start()