-
Notifications
You must be signed in to change notification settings - Fork 2
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
Switched to session as parameter for the fs #11
Conversation
fs_irods/iRODSFS.py
Outdated
raw_info["basic"]["name"] = data_object.name | ||
raw_info["access"]["user"] = data_object.owner_name | ||
|
||
raw_info["details"]["modified"] = data_object.modify_time.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.
I think if using timestamp( )
, we have to be careful since iRODS modify times are UTC.
Observe that running on my computer (EST timezone) I get
>>> datetime.datetime(1970,1,1,0,0).timestamp()
18000.0
But:
>>> utc=datetime.timezone(datetime.timedelta(0))
>>> datetime.datetime(1970,1,1,0,0).replace(tzinfo=utc).timestamp()
0.0
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.
Ah so then it makes sense to always convert them to UTC.
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.
Convert in a matter of speaking yes. Although most people would take "conversion" as a translation from one timezone to another; and we're instead making a naive datetime object into a localized one of the proper timezone, ie UTC.
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.
If these work, I think it's a solid change - with the idea that once the session is given to the pyfilesystem object, it is owned by that object and shouldn't be used outside.
Right - the main idea being that our fs(iRODSFS) object should hold a reference to the session instance, thus preventing it from going out of scope for the lifetime of the pyfilesystem connection. It's a side benefit, I think, by virtue of your changes here, that the iRODS session may be created in any way the user desires. A side-effect is that the iRODSFS object will also need to be kept around for the open file descriptor's benefit, but this might be considered de rigeur anyway. To help enforce the idea, we might document that, as well as maybe give the iRODSFS an |
Closes #9