# Path: newsApp/linkManager.py
# class LinkManager(DbItemManagerV2):
#     """
#     Manage links stored on AWS dynamo db database.
# 
#     Contains functions for CRUD operations on the links stored
# 
#     Following environment variables need to be set -
#     'LINKTAGSTABLE_CONNECTIONSTRING' : connection string of link tags table.
#     """
# 
#     def __init__(self):
#         """
#         Instantiates the linkManager.
#         """
# 
#         DbItemManagerV2.__init__(self,
#             os.environ['LINKTAGSTABLE_CONNECTIONSTRING'])
# 
#     def get(self, linkId):
#         """
#         Put a new link.
#         """
# 
#         dbItem = DbItemManagerV2.get(self, linkId)
#         link = Link(linkId, dbItem.tags)
# 
#         return link
# 
#     def getUnprocessedLinks(self):
#         return DbItemManagerV2.query_2(
#             self,
#             isProcessed__eq = 'false',
#             index = 'isProcessed-itemId-index')
# 
# Path: newsApp/workerJob.py
# class WorkerJob:
#     """
#     Represents a job which can be processed by one of the worker roles.
#     """
# 
#     def __init__(self, jobName, jobParams, jobId = None):
#         """
#         Instantiates a new worker job object.
#         Requires 'jobName': a string representing name of the job
#         Requires 'jobParams': a dictionary where keys represnt job parameter
#             names, and corresponding values the job parameter values.
#         Optional 'jobId': a identier for this job. If not provided a
#             randomly generated alphanumeric string is used.
#         """
# 
#         if (jobId is None):
#             self.jobId = _generateRandomJobId()
#         else :
#             self.jobId = jobId
# 
#         self.jobName = jobName
#         self.jobParams = jobParams
# 
#     def deserializeFromString(self, serializedJob):
#         """
#         Sets this worker job object to the specified serialized string
#         representation.
#         """
# 
#         tempDict = json.loads(serializedJob)
#         jobName = tempDict.pop('jobName', None)
#         jobId = tempDict.pop('jobId', None)
#         self.__init__(jobName, tempDict, jobId)
# 
#     def serializeToString(self):
#         """
#         Serialize to a human-readable string representation of this object
#         """
# 
#         tempDict = dict(self.jobParams)
#         tempDict['jobName'] = self.jobName
#         tempDict['jobId'] = self.jobId
#         return json.dumps(tempDict)
# 
# Path: newsApp/minerJobManager.py
# class MinerJobManager(JobManager):
#     """
#     Helper class to enqueue and dequeue jobs to the miner job queue.
#     """
# 
#     def __init__(self):
#         JobManager.__init__(self, 'MINER_JOBSQUEUE_CONNECTIONSTRING')


from .linkManager import LinkManager
from .workerJob import WorkerJob
from .minerJobManager import MinerJobManager
from .constants import *
from .loggingHelper import *

InitLogging()

def pushLinkJobs():
    """
    Cleanup old links in the links table.
    Run this job periodically.
    """


# Path: newsApp/linkManager.py
# class LinkManager(DbItemManagerV2):
#     """
#     Manage links stored on AWS dynamo db database.
# 
#     Contains functions for CRUD operations on the links stored
# 
#     Following environment variables need to be set -
#     'LINKTAGSTABLE_CONNECTIONSTRING' : connection string of link tags table.
#     """
# 
#     def __init__(self):
#         """
#         Instantiates the linkManager.
#         """
# 
#         DbItemManagerV2.__init__(self,
#             os.environ['LINKTAGSTABLE_CONNECTIONSTRING'])
# 
#     def get(self, linkId):
#         """
#         Put a new link.
#         """
# 
#         dbItem = DbItemManagerV2.get(self, linkId)
#         link = Link(linkId, dbItem.tags)
# 
#         return link
# 
#     def getUnprocessedLinks(self):
#         return DbItemManagerV2.query_2(
#             self,
#             isProcessed__eq = 'false',
#             index = 'isProcessed-itemId-index')
# 
# Path: newsApp/workerJob.py
# class WorkerJob:
#     """
#     Represents a job which can be processed by one of the worker roles.
#     """
# 
#     def __init__(self, jobName, jobParams, jobId = None):
#         """
#         Instantiates a new worker job object.
#         Requires 'jobName': a string representing name of the job
#         Requires 'jobParams': a dictionary where keys represnt job parameter
#             names, and corresponding values the job parameter values.
#         Optional 'jobId': a identier for this job. If not provided a
#             randomly generated alphanumeric string is used.
#         """
# 
#         if (jobId is None):
#             self.jobId = _generateRandomJobId()
#         else :
#             self.jobId = jobId
# 
#         self.jobName = jobName
#         self.jobParams = jobParams
# 
#     def deserializeFromString(self, serializedJob):
#         """
#         Sets this worker job object to the specified serialized string
#         representation.
#         """
# 
#         tempDict = json.loads(serializedJob)
#         jobName = tempDict.pop('jobName', None)
#         jobId = tempDict.pop('jobId', None)
#         self.__init__(jobName, tempDict, jobId)
# 
#     def serializeToString(self):
#         """
#         Serialize to a human-readable string representation of this object
#         """
# 
#         tempDict = dict(self.jobParams)
#         tempDict['jobName'] = self.jobName
#         tempDict['jobId'] = self.jobId
#         return json.dumps(tempDict)
# 
# Path: newsApp/minerJobManager.py
# class MinerJobManager(JobManager):
#     """
#     Helper class to enqueue and dequeue jobs to the miner job queue.
#     """
# 
#     def __init__(self):
#         JobManager.__init__(self, 'MINER_JOBSQUEUE_CONNECTIONSTRING')


# Path: newsApp/pushLinkJobs.py
from .linkManager import LinkManager
from .workerJob import WorkerJob
from .minerJobManager import MinerJobManager
from .constants import *
from .loggingHelper import *


InitLogging()

def pushLinkJobs():
    """
    Cleanup old links in the links table.
    Run this job periodically.
    """


    jobManager = MinerJobManager()