cedadev / item-generator

0 stars 2 forks source link

Failed to load processors #18

Closed ellesmith88 closed 3 years ago

ellesmith88 commented 3 years ago

I was trying to run asset_scanner with description file

datasets:
  - /badc/cmip6/data/
facets:
  extraction_methods:
    - name: regex
      inputs:
        regex: '^(?P<var_id>\w*)_(?P<table_id>\w*)_(?P<source_id>.*)_(?P<experiment_id>\w*)_r(?P<realization_index>\d*)i(?P<initialisation_index>\d*)p(?P<physics_index>\d*)f(?P<forcing_index>\d*)_(?P<grid_label>\w*)_(?P<startdate>\d*)-(?P<enddate>\d*)'
      pre_processors:
        - name: filename_reducer
      post_processors:
        - name: isodate_processor
          inputs:
            date_key: start_datetime
        - name: isodate_processor
          inputs:
            date_key: end_datetime
    - name: regex
      inputs:
        regex: '^\/(?:[^/]*/){3}(?P<mip_era>\w*)\/(?P<activity_id>\w*)\/(?P<institution_id>\w*)\/(?:[^/]*/){6}(?P<version>\w*)'
  aggregation_facets:
    - mip_era
    - activity_id
    - institution_id
    - table_id
    - source_id

but got the errors

2021-07-01 16:06:12,798 asset_scanner.core.handler_picker ERROR Failed to load processor: filename_reducer 2021-07-01 16:06:12,798 asset_scanner.core.handler_picker ERROR Failed to load processor: isodate_processor 2021-07-01 16:06:12,798 asset_scanner.core.handler_picker ERROR Failed to load processor: isodate_processor

I worked out that this was because filename_reducer and isodate_processor didn't exist in self.handlers in asset_scanner.core.handler_picker.HandlerPicker when needed in HandlerPicker.get_processor for the line entry_point = self.handlers.get(name) . I moved filename_reducer = item_generator.extraction_methods.preprocessors:ReducePathtoName and isodate_processor = item_generator.extraction_methods.postprocessors:ISODateProcessor into item_generator.facet_extractors in setup.py which got it working.

rsmith013 commented 3 years ago

I think I moved them into a post-processor and pre-processor section to give them a namespace but then didn't get any way to load them in. It works on my setup because I haven't re-installed the entry-points since I moved them 😂