Skip to content

Commit

Permalink
fix: remove params outputs from DAGs
Browse files Browse the repository at this point in the history
Otherwise, it won't run on Pollination!
  • Loading branch information
mostaphaRoudsari committed Apr 14, 2022
1 parent 8f734b0 commit 580abd6
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 19 deletions.
19 changes: 14 additions & 5 deletions pollination/three_phase/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pollination.honeybee_radiance.sun import CreateSunMatrix, ParseSunUpHours
from pollination.honeybee_radiance.multiphase import PrepareDynamic

from pollination.path.read import ReadJSONList

from .two_phase.entry import TwoPhaseEntryPoint
from .two_phase.dynamic.entry import DynamicGroup
from .three_phase.preparation import ThreePhaseInputsPreparation
Expand Down Expand Up @@ -243,10 +245,12 @@ def prepare_three_phase(
):
return [
{
'from': ThreePhaseInputsPreparation()._outputs.multiplication_info
'from': ThreePhaseInputsPreparation()._outputs.multiplication_info,
'to': '../../calcs/3_phase/info/multiplication_info.json'
},
{
'from': ThreePhaseInputsPreparation()._outputs.grouped_apertures_info
'from': ThreePhaseInputsPreparation()._outputs.grouped_apertures_info,
'to': '../../calcs/3_phase/info/grouped_apertures_info.json'
},
{
'from': ThreePhaseInputsPreparation()._outputs.grouped_apertures_folder,
Expand All @@ -258,12 +262,18 @@ def prepare_three_phase(
}
]

@task(template=ReadJSONList, needs=[prepare_three_phase])
def multiplication_info_to_json(
self, src=prepare_three_phase._outputs.multiplication_info
):
return [{'from': ReadJSONList()._outputs.data}]

@task(
template=ThreePhaseMatrixCalculation,
needs=[
create_rad_folder, prepare_dynamic,
create_total_sky, create_sky_dome,
prepare_three_phase
prepare_three_phase, multiplication_info_to_json
],
sub_folder='calcs/3_phase',
sub_paths={
Expand All @@ -273,9 +283,8 @@ def prepare_three_phase(
def calculate_three_phase_matrix_total(
self,
model_folder=create_rad_folder._outputs.model_folder,
grouped_apertures=prepare_three_phase._outputs.grouped_apertures_info,
grouped_apertures_folder=prepare_three_phase._outputs.grouped_apertures_folder,
multiplication_info=prepare_three_phase._outputs.multiplication_info,
multiplication_info=multiplication_info_to_json._outputs.data,
receivers=create_rad_folder._outputs.receivers,
view_mtx_rad_params=view_mtx_rad_params,
daylight_mtx_rad_params=daylight_mtx_rad_params,
Expand Down
21 changes: 13 additions & 8 deletions pollination/three_phase/three_phase/calculation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from dataclasses import dataclass

from pollination_dsl.dag import Inputs, DAG, task, Outputs
from pollination_dsl.dag.inputs import ItemType
from dataclasses import dataclass
from pollination.path.read import ReadJSONList

from ._view_matrix import ViewMatrixRayTracing
from ._daylight_matrix import DaylightMtxRayTracing
Expand All @@ -14,15 +16,11 @@ class ThreePhaseMatrixCalculation(DAG):
model_folder = Inputs.folder(
description='Radiance model folder', path='model'
)

grouped_apertures = Inputs.list(
description='List fo grouped apertures for daylight matrix calculation.',
items_type=ItemType.JSONObject
)

grouped_apertures_folder = Inputs.folder(
description='A folder with all the grouped apertures for daylight matrix '
'calculation. Use ThreePhaseInputsPreparation to generate this folder.'
'calculation. Use ThreePhaseInputsPreparation to generate this folder. '
'This folder also includes an _info.json file for aperture info.'
)

multiplication_info = Inputs.list(
Expand Down Expand Up @@ -89,10 +87,17 @@ def calculate_view_matrix(
):
pass

@task(template=ReadJSONList, sub_paths={'src': '_info.json'})
def grouped_apertures_info_to_json(
self, src=grouped_apertures_folder
):
return [{'from': ReadJSONList()._outputs.data}]

@task(
template=DaylightMtxRayTracing,
sub_folder='daylight_mtx',
loop=grouped_apertures,
needs=[grouped_apertures_info_to_json],
loop=grouped_apertures_info_to_json._outputs.data,
sub_paths={
'sender_file': '{{item.identifier}}.rad',
'senders_folder': 'aperture_group'
Expand Down
11 changes: 5 additions & 6 deletions pollination/three_phase/three_phase/preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,14 @@ def get_three_phase_combinations(
'calculation.', source='model/sender'
)

grouped_apertures_info = Outputs.list(
description='List fo grouped apertures for daylight matrix calculation.',
source=daylight_matrix_aperture_grouping._outputs.grouped_apertures_file,
items_type=ItemType.JSONObject
grouped_apertures_info = Outputs.file(
description='A JSON file with List of grouped apertures for daylight matrix '
'calculation.', source='model/sender/_info.json'
)

multiplication_info = Outputs.list(
multiplication_info = Outputs.file(
description='A JSON file with matrix multiplication information.',
source='multiplication_info.json', items_type=ItemType.JSONObject
source='multiplication_info.json'
)

results_info = Outputs.file(
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pollination-honeybee-radiance==0.22.2
pollination-path==0.3.1

0 comments on commit 580abd6

Please sign in to comment.