Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(handler): add index field to support chained handlers
One of the creative usage of handlers that [came up](https://github.com/pollination/pollination-alias/blob/21a0db5569c739cfb4f0de6a1dc8b3f1721bfd4c/pollination/alias/outputs/daylight.py#L25-L38) during the development was to use handlers one after another. Luckily the current schema could support this case: ```python OutputAlias.linked( name='results', platform=['rhino'], handler=[ # Preload results IOAliasHandler( language='python', module='pollination_handlers.outputs.daylight', function='read_df_from_folder' ), # load preloaded outputs to Rhino with following method IOAliasHandler( language='csharp', module='Pollination.RhinoHandlers', function='LoadMeshBasedResultsToRhino' ) ] ) ``` The current implementation doesn't indicate which handler should be executed first. In this case since @MingboPeng was the developer of both the Rhino plugin and the Alias he knew how to get it to work but it wouldn't work otherwise. This commit adds an optional index field to IOALiasHandler object to support supporting chained handlers. Default value will be set to 0. That means the code above will look like this: ```python OutputAlias.linked( name='results', platform=['rhino'], handler=[ # Preload results IOAliasHandler( language='python', module='pollination_handlers.outputs.daylight', function='read_df_from_folder', index=0 ), # load preloaded outputs to Rhino with following method IOAliasHandler( language='csharp', module='Pollination.RhinoHandlers', function='LoadMeshBasedResultsToRhino', index=1 ) ] ) ``` This change will make it explicit that the Rhino platform should use the first handler for reading the results and execute that in Python - then pass the results to the second handler and run that one in C# which is the intended behavior.
- Loading branch information