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

TypeError raised when accessing run.active after calling run.close() #3205

Open
awav opened this issue Aug 4, 2024 · 1 comment
Open

TypeError raised when accessing run.active after calling run.close() #3205

awav opened this issue Aug 4, 2024 · 1 comment
Labels
help wanted Extra attention is needed type / bug Issue type: something isn't working

Comments

@awav
Copy link

awav commented Aug 4, 2024

🐛 Bug

When checking the active property of a run object after calling run.close(), a TypeError is raised.

In [5]: run = aim.Run()

In [6]: run.active
Out[6]: True

In [7]: run.close()

In [8]: run.active
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[8], line 1
----> 1 run.active

File ~/.pyenv/versions/3.11.8/envs/nabla-3.11.8/lib/python3.11/site-packages/aim/sdk/run.py:217, in StructuredRunMixin.active(self)
    209 @property
    210 def active(self):
    211     """Check if run is active or not.
    212
    213         :getter: Returns run's active state.
    214         :type: bool
    215     """
    217     if self.end_time:
    218         return False
    219     else:

File ~/.pyenv/versions/3.11.8/envs/nabla-3.11.8/lib/python3.11/site-packages/aim/sdk/run.py:192, in StructuredRunMixin.end_time(self)
    187 """Run finalization time [UTC] as timestamp.
    188
    189     :getter: Returns run finalization time.
    190 """
    191 try:
----> 192     return self.meta_run_tree['end_time']
    193 except KeyError:
    194     # run saved with old version. fallback to sqlite data
    195     return self.props.end_time

TypeError: 'NoneType' object is not subscriptable

To reproduce

  1. Initialize a run object using aim.Run().
  2. Check the active property of the run object. (It returns True as expected).
  3. Close the run object using run.close().
  4. Check the active property of the run object again.

Expected behavior

After calling run.close(), the active property should return False without raising an exception.

Environment

  • aim==3.19.2
    aim-ui==3.19.2
    aimrecords==0.0.7
    aimrocks==0.4.0
  • Python 3.11.8
  • pip 24.0
  • Linux

Additional information

The error appears to be caused by self.meta_run_tree['end_time'] returning None.

A check should be added to ensure self.meta_run_tree is not None before attempting to read the end_time key.
Thank you for looking into this issue.

@awav awav added help wanted Extra attention is needed type / bug Issue type: something isn't working labels Aug 4, 2024
@mihran113
Copy link
Contributor

Hey @awav! Thank a lot for opening the issue. I'll investigate it and would post an update once the fix is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type / bug Issue type: something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants