# Path: seedbox/common/timeutil.py
# def utcnow():
# def is_older_than(before, seconds):
# def is_newer_than(after, seconds):
# def delta_seconds(before, after):
# def total_seconds(delta):
# ONE_WEEK = total_seconds(datetime.timedelta(weeks=1))


import abc
import logging
import os
import traceback
import six
from oslo_config import cfg
from seedbox.common import timeutil
"""Provides the basic definition for a task.

Also handles execution and basic error handling.
"""



LOG = logging.getLogger(__name__)

cfg.CONF.import_group('tasks', 'seedbox.options')


@six.add_metaclass(abc.ABCMeta)
class BaseTask(object):
    """Provides the base definition of a task."""

    def __init__(self, media_file):
        self.media_file = media_file
        self.gen_files = []

    def __call__(self):
        """Provides ability to execute the task in a consistent manner."""
        try:
            _start = timeutil.utcnow()
            self.execute()
            self.media_file.total_time = timeutil.delta_seconds(

# Path: seedbox/common/timeutil.py
# def utcnow():
# def is_older_than(before, seconds):
# def is_newer_than(after, seconds):
# def delta_seconds(before, after):
# def total_seconds(delta):
# ONE_WEEK = total_seconds(datetime.timedelta(weeks=1))


# Path: seedbox/tasks/base.py
import abc
import logging
import os
import traceback
import six
from oslo_config import cfg
from seedbox.common import timeutil

"""Provides the basic definition for a task.

Also handles execution and basic error handling.
"""



LOG = logging.getLogger(__name__)

cfg.CONF.import_group('tasks', 'seedbox.options')


@six.add_metaclass(abc.ABCMeta)
class BaseTask(object):
    """Provides the base definition of a task."""

    def __init__(self, media_file):
        self.media_file = media_file
        self.gen_files = []

    def __call__(self):
        """Provides ability to execute the task in a consistent manner."""
        try:
            _start = timeutil.utcnow()
            self.execute()
            self.media_file.total_time = timeutil.delta_seconds(

                _start, timeutil.utcnow())