You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm guessing that's because scheduler object isn't making use of the database. And I expect it's relevant that I'm seeing this message when calling scheduler.run().
INFO redun:__init__.py:1199 Upgrading db from version -1.0 to 3.1...
How do you set up a scheduler object so that it behaves more like calling redun on the command line? Or do you recommend using RedunClient instead? And could you please add that to the docs?
The text was updated successfully, but these errors were encountered:
Hi @hamr thanks for posting this question. It does appear we haven't fully documented this case. We'll add that. In the meantime here is how you configure the Scheduler to use a persistent database (e.g. sqlite). By default, Scheduler() will use an in-memory database that will not persist the cache between executions (which is what you are seeing).
fromredunimportSchedulerfromredun.configimportConfigscheduler=Scheduler(config=Config({
"backend": {
"db_uri": "sqlite:///redun.db",
}
}))
scheduler.load() # Auto-creates the redun.db file as needed and starts a db connection.result=scheduler.run(main())
In our own code, where we embed a redun Scheduler inside a larger python application we instantiate Scheduler like above. RedunClient() is really only used in tests.
The documentation helpfully provides examples of how to instantiate a Scheduler and run tasks, e.g.
However, that does not appear to take advantage of caching -- tasks run every time -- so it's not quite analogous with running something like
I'm guessing that's because scheduler object isn't making use of the database. And I expect it's relevant that I'm seeing this message when calling
scheduler.run()
.How do you set up a scheduler object so that it behaves more like calling redun on the command line? Or do you recommend using RedunClient instead? And could you please add that to the docs?
The text was updated successfully, but these errors were encountered: