Esempio n. 1
0
def threaded_check_for_job_state_changes():
    """
    Checks the SQS queue specified in the
    :py:data:`SQS_JOB_STATE_CHANGE_QUEUE_NAME <media_nommer.conf.settings.SQS_JOB_STATE_CHANGE_QUEUE_NAME>`
    setting for announcements of state changes from the EC2_ instances running
    :doc:`../ec2nommerd`. This lets :doc:`../feederd` know it needs to get 
    updated job details from the SimpleDB_ domain defined in the
    :py:data:`SIMPLEDB_JOB_STATE_DOMAIN <media_nommer.conf.settings.SIMPLEDB_JOB_STATE_DOMAIN>`
    setting.
    """
    JobCache.refresh_jobs_with_state_changes()
    # If jobs have completed, remove them from the job cache.
    JobCache.uncache_finished_jobs()
Esempio n. 2
0
def threaded_prune_jobs():
    """
    Sometimes failure happens, but a Nommer doesn't handle said failure
    gracefully. Instead of state changing to ``ERROR``, it gets stuck in
    some un-finished state in the SimpleDB_ domain defined in
    :py:data:`SIMPLEDB_JOB_STATE_DOMAIN <media_nommer.conf.settings.SIMPLEDB_JOB_STATE_DOMAIN>`
    setting.
    
    This process finds jobs that haven't been updated in a very long time
    (a day or so) that are probably dead. It marks them with an ``ABANDONED``
    state, letting us know something went really wrong.
    """
    JobCache.abandon_stale_jobs()
    # Expire any newly abandoned jobs, too. Removes them from job cache.
    JobCache.uncache_finished_jobs()
Esempio n. 3
0
def threaded_prune_jobs():
    """
    Sometimes failure happens, but a Nommer doesn't handle said failure
    gracefully. Instead of state changing to ``ERROR``, it gets stuck in
    some un-finished state in the SimpleDB_ domain defined in
    :py:data:`SIMPLEDB_JOB_STATE_DOMAIN <media_nommer.conf.settings.SIMPLEDB_JOB_STATE_DOMAIN>`
    setting.

    This process finds jobs that haven't been updated in a very long time
    (a day or so) that are probably dead. It marks them with an ``ABANDONED``
    state, letting us know something went really wrong.
    """
    JobCache.abandon_stale_jobs()
    # Expire any newly abandoned jobs, too. Removes them from job cache.
    JobCache.uncache_finished_jobs()
Esempio n. 4
0
def threaded_check_for_job_state_changes():
    """
    Checks the SQS queue specified in the
    :py:data:`SQS_JOB_STATE_CHANGE_QUEUE_NAME <media_nommer.conf.settings.SQS_JOB_STATE_CHANGE_QUEUE_NAME>`
    setting for announcements of state changes from the EC2_ instances running
    :doc:`../ec2nommerd`. This lets :doc:`../feederd` know it needs to get
    updated job details from the SimpleDB_ domain defined in the
    :py:data:`SIMPLEDB_JOB_STATE_DOMAIN <media_nommer.conf.settings.SIMPLEDB_JOB_STATE_DOMAIN>`
    setting.
    """
    changed_jobs = JobCache.refresh_jobs_with_state_changes()
    for job in changed_jobs:
        job_state_notifier.send_notification(job)
    # If jobs have completed, remove them from the job cache.
    JobCache.uncache_finished_jobs()