-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Use time.time() for dag file process start time #48004
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
Conversation
airflow/dag_processing/processor.py
Outdated
| @property | ||
| def start_time(self) -> float: | ||
| return self._process.create_time() | ||
| return timezone.utcnow().timestamp() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've probably found the right root cause, but returning now for start_time isn't the fix I don't think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
|
We don't compare it to time.monotonic though -- we compare it to airflow/airflow/dag_processing/manager.py Lines 972 to 975 in 8242ba5
|
31ba78b to
551e735
Compare
|
I ha
Yeah. My description is wrong. I will update the commit message |
551e735 to
900d291
Compare
1d58774 to
4cb35fd
Compare
|
If you are worried about process reuse and the start_time being wrong, then call However the chance of process reuse happening and being the cause of the bugs is tiny. I'm not saying it can't happen, but that the for it to, a large number of processes need to have been created, enough for the pid to overflow and wrap around. I don't know what the limit is, but I suspect it's somewhere around 64k processes on OSX. |
We currently use Psutil's create_time for process start time, which gives the time the process started using the system clock. We can use time.time to track when the process started processing the files instead. In breeze, once the laptop hibbernates, you would have to restart the dag processor but this fixes it. Since this does not happen in other deployments, we suspect that this issue is peculiar to breeze. Closes: apache#47937, Closes: apache#47294
I was able to determine that it’s not process reuse by printing out the previous PIDs before process creation and checking it with the new ID. My observation is that any process created after the heartbeat recovery message of say recovered after 290ms use the time before the recovery instead of the time after the recovery which is when the process started being used for file processing. So instead of using the process start time, we can use the time that the process started processing the files. |
4cb35fd to
7732ffc
Compare
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
|
Closed in favour of #50238 |
We currently use Psutil's create_time for process start time,
which gives the time the process started using the system clock. We can use
time.time to track when the process started processing the files instead.
In breeze, once the laptop hibbernates, you would have to restart the dag
processor but this fixes it. Since this does not happen in other deployments,
we suspect this issue is peculiar to breeze.
Closes: #47937, Closes: #47294