Sorry, to reopen this thread, I have a question close to this one. I want to invoke a method called "plugin_run" from a scheduler task.
def plugin_run(plugin_title, **kw): <- this is the signature plugin_run('http',targets=['https://www.google.pt']) <- valid example considering this, how should I invoke args and vars in the scheduler_task? Thank you On Feb 6, 10:18 pm, Martín Mulone <mulone.mar...@gmail.com> wrote: > Yes I think the json format is strict to " instead of ' > > change with this and try again: > > vars='{"fromDate":"2012-01-01","toDate":"2012-01-31","districtNumber":0}', > > 2012/2/6 Jim Steil <j...@qlf.com> > > > > > > > > > > > Hi > > > I'm having trouble getting my vars json string right on my call to add a > > job to my scheduler. If I run with no vars, it works fine. But, when I > > add my json string I'm getting: > > > Traceback (most recent call last): > > File "C:\dev\web2py\gluon\**scheduler.py", line 159, in executor > > vars = loads(task.vars, object_hook=_decode_dict) > > File "C:\dev\web2py\gluon\contrib\**simplejson\__init__.py", line 403, > > in loads > > return cls(encoding=encoding, **kw).decode(s) > > File "C:\dev\web2py\gluon\contrib\**simplejson\decoder.py", line 403, in > > decode > > obj, end = self.raw_decode(s, idx=_w(s, 0).end()) > > File "C:\dev\web2py\gluon\contrib\**simplejson\decoder.py", line 419, in > > raw_decode > > obj, end = self.scan_once(s, idx) > > File "C:\dev\web2py\gluon\contrib\**simplejson\scanner.py", line 72, in > > scan_once > > return _scan_once(string, idx) > > File "C:\dev\web2py\gluon\contrib\**simplejson\scanner.py", line 43, in > > _scan_once > > _scan_once, object_hook, object_pairs_hook, memo) > > File "C:\dev\web2py\gluon\contrib\**simplejson\decoder.py", line 207, in > > JSONObject > > raise JSONDecodeError("Expecting property name", s, end) > > JSONDecodeError: Expecting property name: line 1 column 1 (char 1) > > > My add_task looks like this: > > > db.scheduler_task.insert( > > status='QUEUED', > > application_name='myApp', > > task_name='Task name', > > function_name='functionname', > > args='[]', > > vars="{'fromDate':'2012-01-01'**,'toDate':'2012-01-31','** > > districtNumber':0}", > > enabled=True, > > start_time=request.now, > > stop_time=request.now+**datetime.timedelta(days=1), > > repeats=1, > > timeout=600) > > > is there something obvious I'm doing wrong? > > > -Jim > > -- > http://www.tecnodoc.com.ar