@@ -528,7 +528,7 @@ def get_info(self):
528528 """
529529 Retrieve all the information about a dataset
530530
531- :returns: a :class:`DSSDatasetInfo` containing all the information about a dataset, such as params, schema, last build infos, status, etc .
531+ :returns: a :class:`DSSDatasetInfo` containing all the information about a dataset.
532532 :rtype: :class:`DSSDatasetInfo`
533533 """
534534 data = self .client ._perform_json ("GET" , "/projects/%s/datasets/%s/info" % (self .project_key , self .dataset_name ))
@@ -879,10 +879,6 @@ class DSSDatasetInfo(object):
879879 """
880880
881881 def __init__ (self , dataset , info ):
882- """
883- :type dataset: :class:`DSSDataset`
884- :type info: dict
885- """
886882 self .dataset = dataset
887883 self .info = info
888884
@@ -895,45 +891,31 @@ def get_raw(self):
895891 """
896892 return self .info
897893
898- def get_raw_last_build (self ):
899- """
900- Get the last build information of the dataset, as a raw dict, or None if there is no last build information.
901-
902- :return: the last build information
903- :rtype: dict or None
904- """
905- return self .info .get ("lastBuild" , None )
906-
907- def get_last_build_start_time (self , as_date = False ):
894+ @property
895+ def last_build_start_time (self ):
908896 """
909- Get the last build start time of the dataset as a timestamp or as a :class:`datetime.datetime`, or None if there
910- is no last build information.
897+ The last build start time of the dataset as a :class:`datetime.datetime` or None if there is no last build information.
911898
912899 :return: the last build start time
913- :rtype: int or :class:`datetime.datetime` or None
900+ :rtype: :class:`datetime.datetime` or None
914901 """
915902 last_build_info = self .info .get ("lastBuild" , dict ())
916903 timestamp = last_build_info .get ("buildStartTime" , None )
904+ return datetime .datetime .fromtimestamp (timestamp / 1000 ) if timestamp is not None else None
917905
918- if as_date and timestamp is not None :
919- return datetime .datetime .fromtimestamp (timestamp / 1000 )
920- return timestamp
921-
922- def get_last_build_end_time (self , as_date = False ):
906+ @property
907+ def last_build_end_time (self ):
923908 """
924- Get the last build end time of the dataset as a timestamp or as a :class:`datetime.datetime`, or None if there
925- is no last build information.
909+ The last build end time of the dataset as a :class:`datetime.datetime` or None if there is no last build information.
926910
927911 :return: the last build end time
928- :rtype: int or :class:`datetime.datetime` or None
912+ :rtype: :class:`datetime.datetime` or None
929913 """
930914 last_build_info = self .info .get ("lastBuild" , dict ())
931915 timestamp = last_build_info .get ("buildEndTime" , None )
916+ return datetime .datetime .fromtimestamp (timestamp / 1000 ) if timestamp is not None else None
932917
933- if as_date and timestamp :
934- return datetime .datetime .fromtimestamp (timestamp / 1000 )
935- return timestamp
936-
918+ @property
937919 def is_last_build_successful (self ):
938920 """
939921 Get whether the last build of the dataset is successful.
@@ -943,5 +925,4 @@ def is_last_build_successful(self):
943925 """
944926 last_build_info = self .info .get ("lastBuild" , dict ())
945927 success = last_build_info .get ("buildSuccess" , False )
946-
947928 return success
0 commit comments