Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIRFLOW-245] Add access to task instance to executors #1596

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow/contrib/executors/mesos_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def start(self):
self.mesos_driver = driver
self.mesos_driver.start()

def execute_async(self, key, command, queue=None):
def execute_async(self, key, command, queue=None, task=None):
self.task_queue.put((key, command))

def sync(self):
Expand Down
4 changes: 2 additions & 2 deletions airflow/executors/base_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def heartbeat(self):
ti.refresh_from_db()
if ti.state != State.RUNNING:
self.running[key] = command
self.execute_async(key, command=command, queue=queue)
self.execute_async(key, command=command, queue=queue, task=ti)
else:
self.logger.debug(
'Task is already running, not sending to '
Expand Down Expand Up @@ -124,7 +124,7 @@ def get_event_buffer(self):
self.event_buffer = {}
return d

def execute_async(self, key, command, queue=None): # pragma: no cover
def execute_async(self, key, command, queue=None, task=None): # pragma: no cover
"""
This method will execute the command asynchronously.
"""
Expand Down
2 changes: 1 addition & 1 deletion airflow/executors/celery_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def start(self):
self.tasks = {}
self.last_state = {}

def execute_async(self, key, command, queue=DEFAULT_QUEUE):
def execute_async(self, key, command, queue=DEFAULT_QUEUE, task=None):
self.logger.info( "[celery] queuing {key} through celery, "
"queue={queue}".format(**locals()))
self.tasks[key] = execute_command.apply_async(
Expand Down
2 changes: 1 addition & 1 deletion airflow/executors/local_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def start(self):
for w in self.workers:
w.start()

def execute_async(self, key, command, queue=None):
def execute_async(self, key, command, queue=None, task=None):
self.queue.put((key, command))

def sync(self):
Expand Down
2 changes: 1 addition & 1 deletion airflow/executors/sequential_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self):
super(SequentialExecutor, self).__init__()
self.commands_to_run = []

def execute_async(self, key, command, queue=None):
def execute_async(self, key, command, queue=None, task=None):
self.commands_to_run.append((key, command,))

def sync(self):
Expand Down