plockaby opened a new pull request #20147:
URL: https://github.com/apache/airflow/pull/20147
I did not have a chance to fix the previously hidden error about cleaning up
files when submitting #20114 before it was merged. When the temporary file's
ownership is changed for impersonation it can't be removed automatically by the
NamedTemporaryFile class so we need to manually remove it with sudo.
Basically, this is to fix this error message when a task finishes:
```
[2021-12-08 06:31:05,703: ERROR/ForkPoolWorker-31] Failed to execute task
[Errno 1] Operation not permitted: '/tmp/tmp9g_3zc5j'.
Traceback (most recent call last):
File
"/usr/local/lib/python3.9/site-packages/airflow/executors/celery_executor.py",
line 121, in _execute_in_fork
args.func(args)
File "/usr/local/lib/python3.9/site-packages/airflow/cli/cli_parser.py",
line 48, in command
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/airflow/utils/cli.py", line
92, in wrapper
return f(*args, **kwargs)
File
"/usr/local/lib/python3.9/site-packages/airflow/cli/commands/task_command.py",
line 292, in task_run
_run_task_by_selected_method(args, dag, ti)
File
"/usr/local/lib/python3.9/site-packages/airflow/cli/commands/task_command.py",
line 105, in _run_task_by_selected_method
_run_task_by_local_task_job(args, ti)
File
"/usr/local/lib/python3.9/site-packages/airflow/cli/commands/task_command.py",
line 163, in _run_task_by_local_task_job
run_job.run()
File "/usr/local/lib/python3.9/site-packages/airflow/jobs/base_job.py",
line 245, in run
self._execute()
File
"/usr/local/lib/python3.9/site-packages/airflow/jobs/local_task_job.py", line
148, in _execute
self.on_kill()
File
"/usr/local/lib/python3.9/site-packages/airflow/jobs/local_task_job.py", line
174, in on_kill
self.task_runner.on_finish()
File
"/usr/local/lib/python3.9/site-packages/airflow/task/task_runner/base_task_runner.py",
line 183, in on_finish
self._error_file.close()
File "/usr/local/lib/python3.9/tempfile.py", line 504, in close
self._closer.close()
File "/usr/local/lib/python3.9/tempfile.py", line 441, in close
unlink(self.name)
PermissionError: [Errno 1] Operation not permitted: '/tmp/tmp9g_3zc5j'
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]