InstituteforDiseaseModeling / idmtools

https://docs.idmod.org/projects/idmtools/en/latest/
Other
4 stars 4 forks source link

BUG: AnalyzeManager fills self.potential_items with platform objects, not idmtools objects #2018

Closed ckirkman-IDM closed 1 year ago

ckirkman-IDM commented 1 year ago

I am trying to use an analyzer I wrote about 11 months ago. It has a per_group method that tries to grab the parent_id for each object. It used to work (following line), but now it returns an error (idmtools 1.7.5 currently, idmtools-calibra 1.0.8)

    def per_group(self, items):
        # Discover all experiment ids from the items
        experiment_ids = {str(item.parent_id) for item_id, item in items.items()}
 File "c:\users\clarkki\code\emodpy-ecosystem\hiv_workflow\hiv_workflow\lib\analysis\download_analyzer_by_experiment.py", line 30, in <setcomp>
    experiment_ids = {str(item.parent_id) for item_id, item in items.items()}
AttributeError: 'Simulation' object has no attribute 'parent_id'

Debugging indicates that the items received by the per_group() analyzer method are of type:

<class 'COMPS.Data.Simulation.Simulation'>

AnalyzeManager line 418:

self._items: Dict[UUID, IEntity] = self._get_items_to_analyze()

... is where the items passed to per_group() are identified.

Documentation for _get_items_to_analyze() indicate that the return is supposed to be idmtools item objects, NOT platform objects: image

ckirkman-IDM commented 1 year ago

I can work around this by replacing: item.parent_id .... with ... item.experiment.id ... or ... item.refresh() item.experiment_id ... but this is not straightforward.

devclinton commented 1 year ago

@ckirkman-IDM - We updated this code to improve performance of the analysis area. Unfortunately, there is no way to easily return idmtools object here and also have high performance. In future would could look at proxy objects, that could dynamically fill in idmtols objects, but that is not currently high priority