starting to figure this out
This commit is contained in:
parent
26bb885801
commit
0bb7656c00
|
@ -0,0 +1,2 @@
|
|||
class CbJob:
|
||||
def status(): pass
|
|
@ -0,0 +1,7 @@
|
|||
class FeLog:
|
||||
def _log (self, sev, msg): print("%s: %s" % (sev, msg))
|
||||
def debug (self, msg): self._log('DEBG', msg)
|
||||
def verbose (self, msg): self._log('VERB', msg)
|
||||
def info (self, msg): self._log('INFO', msg)
|
||||
def warning (self, msg): self._log('WARN', msg)
|
||||
def error (self, msg): self._log('ERR!', msg)
|
27
app/main.py
27
app/main.py
|
@ -1,7 +1,30 @@
|
|||
from flask import Flask
|
||||
from flask_rq2 import RQ as Queue
|
||||
from flask_rq2 import RQ as _RQ
|
||||
from youtube_dl import YoutubeDL as YDL
|
||||
from time import sleep
|
||||
from .log import FeLog
|
||||
from .callbacks import CbJob
|
||||
|
||||
BaseYDLOpts={
|
||||
'no_color': True,
|
||||
'call_home': False,
|
||||
'logger': FeLog(),
|
||||
'progress_hooks': {
|
||||
'status': CbJob.status,
|
||||
},
|
||||
}
|
||||
|
||||
app=Flask(__name__)
|
||||
q=Queue(app)
|
||||
RQ=_RQ(app)
|
||||
|
||||
@RQ.job('test', timeout=30)
|
||||
def DeliberatelyTimesOut():
|
||||
sleep(35)
|
||||
|
||||
@app.route('/')
|
||||
def index(): return 'hewwo'
|
||||
|
||||
@app.route('/add/timeouttest')
|
||||
def timeouttest():
|
||||
j=DeliberatelyTimesOut.queue()
|
||||
return 'queued'
|
|
@ -0,0 +1,6 @@
|
|||
Flask~=1.1.2
|
||||
Flask-RQ2>=18.3
|
||||
rq~=1.5.1
|
||||
rq-dashboard>=0.6.1
|
||||
rq-scheduler>=0.10.0
|
||||
youtube-dl>=2020.7.28
|
Loading…
Reference in New Issue