Git Product home page Git Product logo

Comments (9)

agronholm avatar agronholm commented on June 18, 2024

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Fixed shelve store losing data on an unclean shutdown (fixes #47)

from apscheduler.

agronholm avatar agronholm commented on June 18, 2024

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Interesting observation. I should modify the shelve store to do just that.

from apscheduler.

agronholm avatar agronholm commented on June 18, 2024

Original comment by Josh Harrison (Bitbucket: hijakk, GitHub: hijakk):


Good call. The following changed method in apscheduler/jobstores/shelve_store.py makes the jobs persist properly in my testing.

#!python

def add_job(self, job):
    job.id = self._generate_id()
    self.store[job.id] = job.__getstate__()
    self.store.close()
    self.store = shelve.open(self.path, 'c', self.pickle_protocol)
    self.jobs.append(job)

from apscheduler.

agronholm avatar agronholm commented on June 18, 2024

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Would you mind doing an experiment for me?
Modify the ShelveJobStore code to close and reopen the shelve where it currently just sync()s. See if that makes a difference.

from apscheduler.

agronholm avatar agronholm commented on June 18, 2024

Original comment by Josh Harrison (Bitbucket: hijakk, GitHub: hijakk):


I'm probably doing something wrong, then - like I was saying, when I write
a job to that store and don't either close the jobstore explicitly, shut
down the scheduler, thereby shutting down the jobstore, the job doesn't
persist.

from apscheduler.

agronholm avatar agronholm commented on June 18, 2024

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


I'm not sure what difference that would make, since syncing is always done after write operations.

from apscheduler.

agronholm avatar agronholm commented on June 18, 2024

Original comment by Josh Harrison (Bitbucket: hijakk, GitHub: hijakk):


Not needed

from apscheduler.

agronholm avatar agronholm commented on June 18, 2024

Original comment by Josh Harrison (Bitbucket: hijakk, GitHub: hijakk):


Interesting - ok, what I was encountering was that if I added a job and cherrypy restarted, without closing and reopening the store, that job didn't show up anymore.
I see that I can get to the store directly and force a manual sync with sched._jobstores["shelve"].store.sync(), I'll give that a shot. Thanks!

from apscheduler.

agronholm avatar agronholm commented on June 18, 2024

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


ShelveJobStore already does sync() on all write operations. Not sure what more you want from a commit operation.
ShelveJobStore is a toy, mostly suitable for development.
I wouldn't recommend its use it in production.

from apscheduler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.