Skip to content

Commit

Permalink
Fix empty timestamp for dashboard
Browse files Browse the repository at this point in the history
Signed-off-by: Ruofei Zou <[email protected]>
  • Loading branch information
ruofeiz-lyft committed Oct 21, 2024
1 parent e4a887f commit 4db4706
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions common/amundsen_common/models/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,27 @@
from typing import List, Optional

import attr
from marshmallow import fields
from marshmallow3_annotations.ext.attrs import AttrsSchema


class SafeFloat(fields.Field):
def _serialize(self, value, attr, obj, **kwargs):
if value == '':
return None
try:
return float(value)
except ValueError:
self.fail('invalid', input=value)

def _deserialize(self, value, attr, data, **kwargs):
if value == '':
return None
try:
return float(value)
except ValueError:
self.fail('invalid', input=value)

@attr.s(auto_attribs=True, kw_only=True)
class DashboardSummary:
uri: str = attr.ib()
Expand All @@ -25,3 +43,5 @@ class DashboardSummarySchema(AttrsSchema):
class Meta:
target = DashboardSummary
register_as_scheme = True

last_successful_run_timestamp = SafeFloat()
2 changes: 1 addition & 1 deletion common/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from setuptools import find_packages, setup

__version__ = '0.32.0'
__version__ = '0.33.0'


requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'requirements-dev.txt')
Expand Down

0 comments on commit 4db4706

Please sign in to comment.