class Exec(db.Model): id = db.Column(db.Integer(), primary_key=True) job_name = db.Column(db.String(255), index=True) run_name = db.Column(db.String(255), index=True) wf_target = db.Column(db.String(4096)) run_input = db.Column(db.String(4096)) log = db.Column(db.String(4096)) out_dir = db.Column(db.String(4096)) global_temp_dir = db.Column(db.String(4096)) status = db.Column(db.String(64)) custom_status = db.Column(db.String(64)) custom_status_color = db.Column(db.String(24)) err_message = db.Column(db.String(1500)) retry_count = db.Column(db.Integer()) time_started = db.Column(db.DateTime()) time_finished = db.Column(db.DateTime()) timeout_limit = db.Column(db.DateTime()) pid = db.Column(db.Integer()) username = db.Column(db.String(64), index=True) #! change to user_id later exec_profile = db.Column(db.JSON(none_as_null=True)) exec_profile_name = db.Column(db.String(64)) add_exec_info = db.Column(db.JSON(none_as_null=True)) user_email = db.Column(db.String(64)) access_token = db.Column(db.String(1000)) def __repr__(self): return '<Exec {}>'.format( {self.id, self.status, self.run_name, self.job_name})
class AccessToken(db.Model): id = db.Column(db.Integer(), primary_key=True) token = db.Column(db.String(1000), index=True, unique=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id')) expires_at = db.Column(db.DateTime()) expires_after = db.Column(db.Integer()) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.token = "".join( [random_choice(ascii_letters + digits) for c in range(0, 64)]) self.expires_after = self.expires_after if hasattr( self, "expires_after") else 86400 self.expires_at = datetime.now() + timedelta( seconds=self.expires_after)
class Run(db.Model): id = db.Column(db.Integer(), primary_key=True) run_name = db.Column(db.String(64), index=True) job_name = db.Column(db.String(255), index=True) def __repr__(self): return '<Run {}>'.format({self.id, self.job_name})
class Job(db.Model): id = db.Column(db.Integer(), primary_key=True) job_name = db.Column(db.String(255), index=True, unique=True) username = db.Column(db.String(64), index=True) wf_target = db.Column(db.String(4096)) def __repr__(self): return '<Job {}>'.format({self.id, self.job_name})