Adding unixname to Job and TAskInstance models

This commit is contained in:
Maxime Beauchemin 2014-12-08 05:21:19 +00:00
Родитель f087056f66
Коммит 7e994b030c
2 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -1,4 +1,5 @@
from datetime import datetime
import getpass
import logging
import signal
import sys
@ -40,6 +41,7 @@ class BaseJob(Base):
latest_heartbeat = Column(DateTime())
executor_class = Column(String(500))
hostname = Column(String(500))
unixname = Column(String(1000))
__mapper_args__ = {
'polymorphic_on': job_type,
@ -57,6 +59,7 @@ class BaseJob(Base):
self.start_date = datetime.now()
self.latest_heartbeat = None
self.heartrate = heartrate
self.unixname = getpass.getuser()
super(BaseJob, self).__init__(*args, **kwargs)
def is_alive(self):
@ -309,7 +312,6 @@ class BackfillJob(BaseJob):
ti.state = State.RUNNING
if key not in started:
started.append(key)
if tasks_to_run:
self.heartbeat()
executor.heartbeat()

Просмотреть файл

@ -1,5 +1,6 @@
import copy
from datetime import datetime, timedelta
import getpass
import imp
import jinja2
import logging
@ -205,6 +206,7 @@ class TaskInstance(Base):
state = Column(String(20))
try_number = Column(Integer)
hostname = Column(String(1000))
unixname = Column(String(1000))
def __init__(self, task, execution_date):
self.dag_id = task.dag_id
@ -212,6 +214,7 @@ class TaskInstance(Base):
self.execution_date = execution_date
self.task = task
self.try_number = 1
self.unixname = getpass.getuser()
def command(
self,