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

Correctly record the time when a dataset is created and update the last_used time #945

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

BenGalewsky
Copy link
Contributor

Problem

The create time is incorrectly been set to 0 and the last_used time set to the current date/time. The last used time is never updated so it is useless.

Resolves #906

Approach

Set the last_updated and last_used fields to the current time when the dataset is created. Update the record to set last_used whenever a cached dataset is used in subsequent transforms

…last_used time whenever

the dataset is used in a transform.

The create time had incorrectly been set to 0 and the last_used time set to the current date/time.
We now correclty set the last_updated time to the current time along with last_used. Then any time the
dataset is referenced, we update last_used.
@@ -54,7 +54,7 @@ def from_did(cls, did: DIDParser, logger: Logger, extras: dict[str, str] = None,
dataset = Dataset(
name=did.full_did,
last_used=datetime.now(tz=timezone.utc),
last_updated=datetime.fromtimestamp(0),
last_updated=datetime.now(tz=timezone.utc),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be more consistent if last_updated were set to last_used when the dataset is first created (as opposed to being marginally later, as now)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update last_used field in Dataset
2 participants