adimian / kirby

Event-driven task execution framework based on Kafka
MIT License
6 stars 4 forks source link

unable to display schedule #24

Closed ericgazoni closed 5 years ago

ericgazoni commented 5 years ago

When trying to open the /schedule endpoint I'm getting this error:

[2019-05-21 22:34:58,435] ERROR in app: Exception on /schedule [GET]
Traceback (most recent call last):
  File "/Users/eric/.virtualenvs/kirby/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/eric/.virtualenvs/kirby/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/eric/.virtualenvs/kirby/lib/python3.6/site-packages/flask_restplus/api.py", line 325, in wrapper
    resp = resource(*args, **kwargs)
  File "/Users/eric/.virtualenvs/kirby/lib/python3.6/site-packages/flask/views.py", line 88, in view
    return self.dispatch_request(*args, **kwargs)
  File "/Users/eric/.virtualenvs/kirby/lib/python3.6/site-packages/flask_restplus/resource.py", line 44, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/Users/eric/.virtualenvs/kirby/lib/python3.6/site-packages/flask_restplus/marshalling.py", line 136, in wrapper
    resp = f(*args, **kwargs)
  File "/Users/eric/workspace/adimian/kirby/kirby/web/endpoints.py", line 172, in get
    for schedule in context.schedules
  File "/Users/eric/workspace/adimian/kirby/kirby/web/endpoints.py", line 172, in <listcomp>
    for schedule in context.schedules
  File "/Users/eric/workspace/adimian/kirby/kirby/web/endpoints.py", line 121, in should_run
    schedule.weekday or "*",
  File "/Users/eric/.virtualenvs/kirby/lib/python3.6/site-packages/cronex/__init__.py", line 108, in __init__
    self.compute_numtab()
  File "/Users/eric/.virtualenvs/kirby/lib/python3.6/site-packages/cronex/__init__.py", line 147, in compute_numtab
    unified.update(parse_atom(cron_atom, span))
  File "/Users/eric/.virtualenvs/kirby/lib/python3.6/site-packages/cronex/__init__.py", line 351, in parse_atom
    raise ValueError("Unrecognized symbol \"%s\"" % subrange)
ValueError: Unrecognized symbol ""

This is the schedule I'm using: image

You can reproduce using the kirby demo command

PierreSavatte commented 5 years ago

That is the reason that it is not working :
image

Would you suggest to write a pre-parser? Use any other library which handle cron expressions?

ericgazoni commented 5 years ago

I don't know what's the intent behind using CronExpression, what do you propose?

PierreSavatte commented 5 years ago

Using a CronExpression we are able to do : CronExpression.check_trigger(now).

cronex was the only library I found when I was searching for a cron expression parser that allows to do this.

Maybe a pre-parser or a validator when a new Schedule is created?

ericgazoni commented 5 years ago

yup, basically running cronex everytime a Schedule is modified looks like a plan