9.1.2.16. GeoHealthCheck.scheduler

9.1.2.16.1. Module Contents

9.1.2.16.1.1. Functions

db_commit()

run_job(resource_id, frequency)

Runs single job (all Probes) for single Resource.

start_schedule()

check_schedule()

lifecycle_listener(event)

error_listener(event)

get_job(resource)

update_job(resource)

add_job(resource)

stop_job(resource_id)

stop_schedule()

9.1.2.16.1.2. Attributes

LOGGER

DB

scheduler

GeoHealthCheck.scheduler.LOGGER
GeoHealthCheck.scheduler.DB
GeoHealthCheck.scheduler.scheduler
GeoHealthCheck.scheduler.db_commit()
GeoHealthCheck.scheduler.run_job(resource_id, frequency)

Runs single job (all Probes) for single Resource. As multiple instances of the job scheduler may run in different processes and threads, the database is used to synchronize and assure only one job will run. This is achieved by having one lock per Resource. Only the process/thread that acquires its related ResourceLock record runs the job. As to avoid permanent “lockouts”, each ResourceLock has a lifetime, namely the timespan until the next Run as configured for/per Resource. This gives all job runners a chance to obtain a lock once “time’s up” for the ResourceLock.

An extra check for lock obtainment is made via an unique UUID per job runner. Once the lock is obtained the UUID-field of the lock record is set and committed to the DB. If we then try to obtain the lock again (by reading from DB) but the UUID is different this means another job runner instance did the same but was just before us. The lock timespan will guard that a particular UUID will keep the lock forever, e.g. if the application is suddenly shutdown.

Parameters:
  • resource_id

  • frequency

Returns:

GeoHealthCheck.scheduler.start_schedule()
GeoHealthCheck.scheduler.check_schedule()
GeoHealthCheck.scheduler.lifecycle_listener(event)
GeoHealthCheck.scheduler.error_listener(event)
GeoHealthCheck.scheduler.get_job(resource)
GeoHealthCheck.scheduler.update_job(resource)
GeoHealthCheck.scheduler.add_job(resource)
GeoHealthCheck.scheduler.stop_job(resource_id)
GeoHealthCheck.scheduler.stop_schedule()