updated comments
This commit is contained in:
16
job.py
16
job.py
@@ -15,7 +15,7 @@ from flask_login import login_required, current_user
|
|||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Class describing Job in the database, and via sqlalchemy, connected to the DB as well
|
# Class describing extra/specific info for a Job and via sqlalchemy, connected to the DB as well
|
||||||
################################################################################
|
################################################################################
|
||||||
class JobExtra(db.Model):
|
class JobExtra(db.Model):
|
||||||
__tablename__ = "jobextra"
|
__tablename__ = "jobextra"
|
||||||
@@ -27,6 +27,9 @@ class JobExtra(db.Model):
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<id: {}, job_id: {}, name: {}, value: {}>".format(self.id, self.job_id, self.name, self.value )
|
return "<id: {}, job_id: {}, name: {}, value: {}>".format(self.id, self.job_id, self.name, self.value )
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Class describing logs for each job and via sqlalchemy, connected to the DB as well
|
||||||
|
################################################################################
|
||||||
class Joblog(db.Model):
|
class Joblog(db.Model):
|
||||||
id = db.Column(db.Integer, db.Sequence('joblog_id_seq'), primary_key=True )
|
id = db.Column(db.Integer, db.Sequence('joblog_id_seq'), primary_key=True )
|
||||||
job_id = db.Column(db.Integer, db.ForeignKey('job.id'), primary_key=True )
|
job_id = db.Column(db.Integer, db.ForeignKey('job.id'), primary_key=True )
|
||||||
@@ -36,6 +39,9 @@ class Joblog(db.Model):
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<id: {}, job_id: {}, log: {}".format(self.id, self.job_id, self.log )
|
return "<id: {}, job_id: {}, log: {}".format(self.id, self.job_id, self.log )
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Class describing Job and via sqlalchemy, connected to the DB as well
|
||||||
|
################################################################################
|
||||||
class Job(db.Model):
|
class Job(db.Model):
|
||||||
id = db.Column(db.Integer, db.Sequence('job_id_seq'), primary_key=True )
|
id = db.Column(db.Integer, db.Sequence('job_id_seq'), primary_key=True )
|
||||||
start_time = db.Column(db.DateTime(timezone=True))
|
start_time = db.Column(db.DateTime(timezone=True))
|
||||||
@@ -56,12 +62,18 @@ class Job(db.Model):
|
|||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Utility classes for Jobs
|
# Used in main html to show a red badge of # jobs to draw attention there are
|
||||||
|
# active jobs being processed in the background
|
||||||
################################################################################
|
################################################################################
|
||||||
def GetNumActiveJobs():
|
def GetNumActiveJobs():
|
||||||
ret = db.engine.execute("select count(1) from job where pa_job_state is distinct from 'Completed'").first()
|
ret = db.engine.execute("select count(1) from job where pa_job_state is distinct from 'Completed'").first()
|
||||||
return ret.count
|
return ret.count
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# this function uses sockets to force wake the job mgr / option from Admin menu
|
||||||
|
# should never really be needed, but was useful when developing / the job
|
||||||
|
# engine got 'stuck' when jobs were run in parallel
|
||||||
|
################################################################################
|
||||||
def WakePAJobManager():
|
def WakePAJobManager():
|
||||||
try:
|
try:
|
||||||
print("Waking up PA Job Manager")
|
print("Waking up PA Job Manager")
|
||||||
|
|||||||
Reference in New Issue
Block a user