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

Fix timestamp issue for python2 in s3 #846

Merged
merged 1 commit into from
Dec 5, 2021

Conversation

akyrola
Copy link
Contributor

@akyrola akyrola commented Dec 1, 2021

Thanks to @romain-intel 's integration tests, he noticed that the #778 had a bug for python2: datetime had .timestamp() function only since python 3.3.

This PR replaces the .timestamp() with a get_timestamp() function that calculates the timestamp using datetime operations.

Test with both py2 and py3:

Python 2.7.15 | packaged by conda-forge | (default, Mar  5 2020, 14:58:04) 
[GCC Clang 9.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from metaflow import S3
>>> s3 = S3()
>>> info = s3.info_many(['s3://aapo-mf-test/mnist/t10k-labels-idx1-ubyte.gz', 's3://aapo-mf-test/mnist/train-labels-idx1-ubyte.gz'])
>>> info[0].last_modified, info[1].last_modified
(1632312604.0, 1632312562.0)
>>> 


(py2) MacBook-Pro-5:metaflow akyrola$ conda activate metaflow_dev
(metaflow_dev) MacBook-Pro-5:metaflow akyrola$ aws-vault exec mfdeveloper --  python
Python 3.9.7 | packaged by conda-forge | (default, Sep 14 2021, 01:18:03) 
[Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from metaflow import S3
>>> s3 = S3()
>>> info = s3.info_many(['s3://aapo-mf-test/mnist/t10k-labels-idx1-ubyte.gz', 's3://aapo-mf-test/mnist/train-labels-idx1-ubyte.gz'])
>>> info[0].last_modified, info[1].last_modified

@savingoyal savingoyal merged commit aa51c0b into Netflix:master Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants