@@ -1692,19 +1692,24 @@ def file_upload(
1692
1692
json_encoder: Custom encoder to use to encode the experiment.
1693
1693
1694
1694
Additional info:
1695
- The filename is expected to end with ".json" (otherwise it will be added)
1695
+ The filename is expected to end with ".json", ".yaml", or ".zip", otherwise
1696
+ ".json" will be added,
1696
1697
and the data itself should be either a dictionary or a JSON serialization
1697
1698
with the default encoder.
1698
1699
"""
1699
- # currently the resultdb enforces files to end with .json or .yaml
1700
+ # currently resultdb enforces files to end with .json, .yaml, or .zip
1700
1701
# without suffix, we assume json formatting
1701
- if not (file_name .endswith (".json" ) or file_name .endswith (".yaml" )):
1702
+ if not (
1703
+ file_name .endswith (".json" )
1704
+ or file_name .endswith (".yaml" )
1705
+ or file_name .endswith (".zip" )
1706
+ ):
1702
1707
file_name += ".json"
1703
1708
if isinstance (file_data , dict ):
1704
1709
# for now we avoid using custom encoder with yaml files
1705
1710
if file_name .endswith (".yaml" ):
1706
1711
file_data = yaml .dump (file_data )
1707
- else :
1712
+ elif file_name . endswith ( ".json" ) :
1708
1713
file_data = json .dumps (file_data , cls = json_encoder )
1709
1714
self ._api_client .experiment_file_upload (experiment_id , file_name , file_data )
1710
1715
@@ -1722,10 +1727,14 @@ def file_download(
1722
1727
Returns:
1723
1728
The JSON deserialization of the data file
1724
1729
Additional info:
1725
- The filename is expected to end with ".json", otherwise
1726
- it will be added.
1730
+ The filename is expected to end with ".json", ".yaml", or ".zip", otherwise
1731
+ ".json" will be added.
1727
1732
"""
1728
- if not (file_name .endswith (".json" ) or file_name .endswith (".yaml" )):
1733
+ if not (
1734
+ file_name .endswith (".json" )
1735
+ or file_name .endswith (".yaml" )
1736
+ or file_name .endswith (".zip" )
1737
+ ):
1729
1738
file_name += ".json"
1730
1739
# for now we avoid using custom decoder with yaml files
1731
1740
file_data = self ._api_client .experiment_file_download (
0 commit comments