# Path: media_nommer/conf/settings.py
# AWS_ACCESS_KEY_ID = None
# AWS_SECRET_ACCESS_KEY = None
# CONFIG_S3_BUCKET = 'nommer_config'
# SQS_NEW_JOB_QUEUE_NAME = 'media_nommer'
# SQS_JOB_STATE_CHANGE_QUEUE_NAME = 'media_nommer_jstate'
# SIMPLEDB_JOB_STATE_DOMAIN = 'media_nommer'
# SIMPLEDB_EC2_NOMMER_STATE_DOMAIN = 'media_nommer_ec2nommer_state'
# EC2_KEY_NAME = None
# EC2_SECURITY_GROUPS = ['media_nommer']
# EC2_AMI_ID = 'ami-eb558182'
# EC2_INSTANCE_TYPE = 'm1.large'
# MAX_ENCODING_JOBS_PER_EC2_INSTANCE = 2
# MAX_NUM_EC2_INSTANCES = 3
# JOB_OVERFLOW_THRESH = 2
# FEEDERD_JOB_STATE_CHANGE_CHECK_INTERVAL = 60
# FEEDERD_PRUNE_JOBS_INTERVAL = 60 * 5
# FEEDERD_ALLOW_EC2_LAUNCHES = True
# FEEDERD_ABANDON_INACTIVE_JOBS_THRESH = 3600 * 9
# FEEDERD_AUTO_SCALE_INTERVAL = 60
# NOMMERD_TERMINATE_WHEN_IDLE = True
# NOMMERD_MAX_INACTIVITY = 60 * 10
# NOMMERD_HEARTBEAT_INTERVAL = 60
# NOMMERD_NEW_JOB_CHECK_INTERVAL = 60
# NOMMERD_QTFASTSTART_BIN_PATH = '/home/nom/.virtualenvs/media_nommer/bin/qtfaststart'
# STORAGE_BACKENDS = {
#     's3': 'media_nommer.core.storage_backends.s3.S3Backend',
#     'http': 'media_nommer.core.storage_backends.http.HTTPBackend',
#     'https': 'media_nommer.core.storage_backends.http.HTTPBackend',
#     'file': 'media_nommer.core.storage_backends.file.FileBackend',
# }
# 
# Path: media_nommer/utils/logger.py
# def debug(message):
# def info(message):
# def warning(message):
# def error(message_or_obj=None):
# 
# Path: media_nommer/utils/compat.py
# def total_seconds(td):
#     """
#     Given a timedelta object, compute the total number of seconds elapsed
#     for the entire delta. This is only available in the standard library for
#     Python 2.7 and up.
#     
#     Source: http://docs.python.org/library/datetime.html#datetime.timedelta.total_seconds
#     
#     :param datetime.timedelta td: A timedelta instance.
#     :rtype: float
#     :returns: The seconds elapsed during the timedelta.
#     """
#     return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10 ** 6) / 10 ** 6.0


import urllib2
import datetime
import boto
from twisted.internet import reactor
from media_nommer.conf import settings
from media_nommer.utils import logger
from media_nommer.utils.compat import total_seconds
    __aws_sdb_nommer_state_domain = None
    # Used for lazy-loading the EC2 connection. Do not refer to directly.
    __aws_ec2_connection = None
    # Store the instance ID for this EC2 node (if not local).
    __instance_id = None

    @classmethod
    def _aws_ec2_connection(cls):
        """
        Lazy-loading of the EC2 boto connection. Refer to this instead of
        referencing cls.__aws_ec2_connection directly.
        
        :returns: A boto connection to Amazon's EC2 interface.
        """
        if not cls.__aws_ec2_connection:
            cls.__aws_ec2_connection = boto.connect_ec2(
                settings.AWS_ACCESS_KEY_ID,
                settings.AWS_SECRET_ACCESS_KEY)
        return cls.__aws_ec2_connection

    @classmethod
    def _aws_sdb_connection(cls):
        """
        Lazy-loading of the SimpleDB boto connection. Refer to this instead of
        referencing cls.__aws_sdb_connection directly.
        
        :returns: A boto connection to Amazon's SimpleDB interface.
        """
        if not cls.__aws_sdb_connection:
            cls.__aws_sdb_connection = boto.connect_sdb(

# Path: media_nommer/conf/settings.py
# AWS_ACCESS_KEY_ID = None
# AWS_SECRET_ACCESS_KEY = None
# CONFIG_S3_BUCKET = 'nommer_config'
# SQS_NEW_JOB_QUEUE_NAME = 'media_nommer'
# SQS_JOB_STATE_CHANGE_QUEUE_NAME = 'media_nommer_jstate'
# SIMPLEDB_JOB_STATE_DOMAIN = 'media_nommer'
# SIMPLEDB_EC2_NOMMER_STATE_DOMAIN = 'media_nommer_ec2nommer_state'
# EC2_KEY_NAME = None
# EC2_SECURITY_GROUPS = ['media_nommer']
# EC2_AMI_ID = 'ami-eb558182'
# EC2_INSTANCE_TYPE = 'm1.large'
# MAX_ENCODING_JOBS_PER_EC2_INSTANCE = 2
# MAX_NUM_EC2_INSTANCES = 3
# JOB_OVERFLOW_THRESH = 2
# FEEDERD_JOB_STATE_CHANGE_CHECK_INTERVAL = 60
# FEEDERD_PRUNE_JOBS_INTERVAL = 60 * 5
# FEEDERD_ALLOW_EC2_LAUNCHES = True
# FEEDERD_ABANDON_INACTIVE_JOBS_THRESH = 3600 * 9
# FEEDERD_AUTO_SCALE_INTERVAL = 60
# NOMMERD_TERMINATE_WHEN_IDLE = True
# NOMMERD_MAX_INACTIVITY = 60 * 10
# NOMMERD_HEARTBEAT_INTERVAL = 60
# NOMMERD_NEW_JOB_CHECK_INTERVAL = 60
# NOMMERD_QTFASTSTART_BIN_PATH = '/home/nom/.virtualenvs/media_nommer/bin/qtfaststart'
# STORAGE_BACKENDS = {
#     's3': 'media_nommer.core.storage_backends.s3.S3Backend',
#     'http': 'media_nommer.core.storage_backends.http.HTTPBackend',
#     'https': 'media_nommer.core.storage_backends.http.HTTPBackend',
#     'file': 'media_nommer.core.storage_backends.file.FileBackend',
# }
# 
# Path: media_nommer/utils/logger.py
# def debug(message):
# def info(message):
# def warning(message):
# def error(message_or_obj=None):
# 
# Path: media_nommer/utils/compat.py
# def total_seconds(td):
#     """
#     Given a timedelta object, compute the total number of seconds elapsed
#     for the entire delta. This is only available in the standard library for
#     Python 2.7 and up.
#     
#     Source: http://docs.python.org/library/datetime.html#datetime.timedelta.total_seconds
#     
#     :param datetime.timedelta td: A timedelta instance.
#     :rtype: float
#     :returns: The seconds elapsed during the timedelta.
#     """
#     return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10 ** 6) / 10 ** 6.0


# Path: media_nommer/ec2nommerd/node_state.py
import urllib2
import datetime
import boto
from twisted.internet import reactor
from media_nommer.conf import settings
from media_nommer.utils import logger
from media_nommer.utils.compat import total_seconds

    __aws_sdb_nommer_state_domain = None
    # Used for lazy-loading the EC2 connection. Do not refer to directly.
    __aws_ec2_connection = None
    # Store the instance ID for this EC2 node (if not local).
    __instance_id = None

    @classmethod
    def _aws_ec2_connection(cls):
        """
        Lazy-loading of the EC2 boto connection. Refer to this instead of
        referencing cls.__aws_ec2_connection directly.
        
        :returns: A boto connection to Amazon's EC2 interface.
        """
        if not cls.__aws_ec2_connection:
            cls.__aws_ec2_connection = boto.connect_ec2(
                settings.AWS_ACCESS_KEY_ID,
                settings.AWS_SECRET_ACCESS_KEY)
        return cls.__aws_ec2_connection

    @classmethod
    def _aws_sdb_connection(cls):
        """
        Lazy-loading of the SimpleDB boto connection. Refer to this instead of
        referencing cls.__aws_sdb_connection directly.
        
        :returns: A boto connection to Amazon's SimpleDB interface.
        """
        if not cls.__aws_sdb_connection:
            cls.__aws_sdb_connection = boto.connect_sdb(

                settings.AWS_ACCESS_KEY_ID,