@@ -779,22 +779,22 @@ def write_metadata_file(datasource_path, spec):
779
779
# mc.set_lineage(LINEAGE_STATEMENT)
780
780
781
781
if 'about' in spec :
782
- resource .set_abstract (spec ['about' ])
782
+ resource .set_description (spec ['about' ])
783
783
attr_spec = None
784
784
if 'columns' in spec :
785
785
attr_spec = spec ['columns' ]
786
786
if 'fields' in spec :
787
787
attr_spec = spec ['fields' ]
788
788
if attr_spec :
789
789
for key , value in attr_spec .items ():
790
- abstract = value ['about' ] if 'about' in value else ''
790
+ about = value ['about' ] if 'about' in value else ''
791
791
if 'units' in value :
792
792
units = spec_utils .format_unit (value ['units' ])
793
793
else :
794
794
units = ''
795
795
try :
796
796
resource .set_field_description (
797
- key , abstract = abstract , units = units )
797
+ key , description = about , units = units )
798
798
except KeyError as error :
799
799
LOGGER .warning (error )
800
800
if 'bands' in spec :
@@ -809,23 +809,22 @@ def write_metadata_file(datasource_path, spec):
809
809
resource .write ()
810
810
811
811
812
- def generate_metadata (execute_func ):
813
- execute_func_args = inspect .getfullargspec (execute_func )
814
- model_module = importlib .import_module (execute_func .__module__ )
815
- spec = model_module ['MODEL_SPEC' ]['outputs' ]
816
-
817
- workspace = execute_func_args .args ['workspace_dir' ]
818
- results_suffix = execute_func_args .args .get ('results_suffix' , '' )
819
- for filename , data in spec .items ():
812
+ def generate_metadata (output_spec , workspace , file_suffix ):
813
+ for filename , data in output_spec .items ():
814
+ # print(filename)
820
815
if 'type' in data and data ['type' ] == 'directory' :
821
816
if 'taskgraph.db' in data ['contents' ]:
822
817
continue
818
+ print (data ['contents' ])
823
819
generate_metadata (
824
- data ['contents' ], os .path .join (workspace , filename ))
820
+ data ['contents' ], os .path .join (workspace , filename ), file_suffix )
825
821
else :
826
822
pre , post = os .path .splitext (filename )
827
- full_path = os .path .join (workspace , pre + results_suffix + post )
828
- try :
829
- write_metadata_file (full_path , data )
830
- except ValueError as error :
831
- LOGGER .warning (error )
823
+ full_path = os .path .join (workspace , pre + file_suffix + post )
824
+ print (full_path )
825
+ if os .path .exists (full_path ):
826
+ try :
827
+ write_metadata_file (full_path , data )
828
+ except ValueError as error :
829
+ # Some unsupported file formats, e.g. html
830
+ LOGGER .warning (error )
0 commit comments