Kraysent / OMTool

Modeling N-Body problem in galactic evolution application.
https://omtool.readthedocs.io/en/latest/
Apache License 2.0
0 stars 0 forks source link

Use tasks' output in next tasks inputs #145

Closed Kraysent closed 1 year ago

Kraysent commented 1 year ago

Proposed feature would divide task parameteres into static and dynamic. Static ones are described in args section of the configuration while dynamic ones are in inputs section.

Static parameters do not change once task is described. Dynamic ones take their values based on the output of the previously launched tasks. Minimal example is as follows:

tasks:
  - name: PotentialCenterTask
    id: host_potential_center
    actions_before:
      - type: slice
        parts: [[0, 0.6666]]
  - name: PotentialCenterTask
    id: sat_potential_center
    actions_before:
      - type: slice
        parts: [[0.6666, 1]]
  - name: DistanceTask
    inputs:
      start_position: host_potential_center.position
      end_position: sat_potential_center.position
    actions_after:
      - type: logging
        print_last: True
        id: distance_data

Here, DistanceTask should have **kwargs in its run method with names start_position and end_position. OMTool would read these values from the PotentialCenterTask's output under the key position. This key should hold valid value that would be passed into the run method.

Several new fields would be added to the task description:

Kraysent commented 1 year ago

Need to update documentation of the tasks and remove deprecated static arguments of the tasks