_job_start_time records the populating host's local time, with no zone
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
populate() stores _job_start_time as naive local time on whichever host runs it: start_time = time.time() (autopopulate.py:665), then written as datetime.datetime.fromtimestamp(start_time) (autopopulate.py:742). Two hosts in different time zones write different values for the same instant, and nothing in the row records which zone applies. A populate() run from a laptop in US Central and one from a worker in UTC leave start times five hours apart for computations that ran at the same moment.
The other timestamps the framework writes use a known clock:
_prov.timeis UTC:datetime.datetime.now(datetime.timezone.utc).isoformat()(provenance.py:103).- The job table's
completed_timeis the server'sCURRENT_TIMESTAMP(jobs.py:499,529).
A reader cannot place _job_start_time on either of those scales unless every host that populates the schema runs in the same zone.
Proposal
- Take
_job_start_timefrom the server's clock, as the job table already does forcompleted_time(jobs.py:498-499) andscheduled_time(jobs.py:388). Compute it in theUPDATEthat already writes the hidden columns (autopopulate.py:874), as the server's current time minus_job_duration. That adds no round trip, and every host that populates the schema then writes on one clock, whatever zone the host runs in. - The server expression must be statement time, not transaction time:
NOW(3)on MySQL, andstatement_timestamp()on PostgreSQL, whereCURRENT_TIMESTAMPis the start of the transaction. It belongs in the adapter, besidecurrent_user_expr(). - Keep measuring
_job_durationon the worker. It is a difference of two readings on one clock, so neither zone nor skew affects it. TheUPDATEruns after the commit that_job_durationalready includes, so the derived start is late by the one-way latency of that statement, which is the same error a separateSELECTat start would carry. - State in
job-metadata.md(datajoint-docs) that_job_start_timeuses the server's clock from the release that ships the change, and that rows written earlier carry the populating host's local time. Those rows cannot be corrected after the fact, because the zone was never recorded.
- Vorherrschende Sprache
- Python
- Sterne
- 197
- Forks
- 99
- Ø Merge
- 2 T. 10 Std.
- Gemergte PRs (30 T.)
- 12
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus datajoint/datajoint-python
-
MySQL error 1143 (column-level SELECT denied) is not translated to AccessErrorEvtl. vergeben @Bhanu73120 hat das vor 4 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
datajoint/datajoint-python#1586 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
len() of an expression with an empty primary key generates invalid SQLEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
datajoint/datajoint-python#1581 ·
Maintainer antworten meist innerhalb von 1 Tag
-
dj.Diagram theme: make the font configurableEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
datajoint/datajoint-python#1539 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
A join on namesake secondary attributes raises the stale-`~lineage` error on a freshly declared schemaEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenbug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 82/100
datajoint/datajoint-python#1640 ·
Maintainer antworten meist innerhalb von 1 Tag
-
PostgreSQL: renaming an attribute of a dj.U restriction quotes it with backticksEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenbug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 75/100
datajoint/datajoint-python#1638 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in datajoint/datajoint-python
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
webrecorder/warcio#209 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Jeffy123-zhu/logspecter#20 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 1 Tag