Skip to content

Commit

Permalink
fix(comfort): Update comfort recipes to use explicit Copy function
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Mar 3, 2021
1 parent f0a5b6d commit 16ca70c
Show file tree
Hide file tree
Showing 15 changed files with 323 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ def output_parameters(self):
return [{'name': 'grids-list', 'from': 'output/grids_info.json', 'to': os.path.join(self.params_folder, 'output/grids_info.json')}]


class _AnnualRadiationRayTracing_8e859993Orchestrator(luigi.WrapperTask):
class _AnnualRadiationRayTracing_a5b4547cOrchestrator(luigi.WrapperTask):
"""Runs all the tasks in this module."""
# user input for this module
_input_params = luigi.DictParameter()
Expand Down
10 changes: 5 additions & 5 deletions lbt_recipes/adaptive_comfort_map/flow/dependencies/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import luigi
import os
from queenbee_local import QueenbeeTask
from .dependencies.annual_radiation_ray_tracing import _AnnualRadiationRayTracing_8e859993Orchestrator as AnnualRadiationRayTracing_8e859993Workerbee
from .dependencies.annual_radiation_ray_tracing import _AnnualRadiationRayTracing_a5b4547cOrchestrator as AnnualRadiationRayTracing_a5b4547cWorkerbee


_default_inputs = { 'model': None,
Expand Down Expand Up @@ -118,7 +118,7 @@ def map_dag_inputs(self):
return inputs

def run(self):
yield [AnnualRadiationRayTracing_8e859993Workerbee(_input_params=self.map_dag_inputs)]
yield [AnnualRadiationRayTracing_a5b4547cWorkerbee(_input_params=self.map_dag_inputs)]
with open(os.path.join(self.execution_folder, 'annual_radiation_raytracing.done'), 'w') as out_file:
out_file.write('done!\n')

Expand Down Expand Up @@ -177,7 +177,7 @@ def output(self):


class CopyGridInfo(QueenbeeTask):
"""Copy files and folder."""
"""Copy a file or folder to a destination."""

# DAG Input parameters
_input_params = luigi.DictParameter()
Expand Down Expand Up @@ -229,7 +229,7 @@ def output_artifacts(self):


class CopySunUpHours(QueenbeeTask):
"""Copy files and folder."""
"""Copy a file or folder to a destination."""

# DAG Input parameters
_input_params = luigi.DictParameter()
Expand Down Expand Up @@ -699,7 +699,7 @@ def output_artifacts(self):
}]


class _Main_8e859993Orchestrator(luigi.WrapperTask):
class _Main_a5b4547cOrchestrator(luigi.WrapperTask):
"""Runs all the tasks in this module."""
# user input for this module
_input_params = luigi.DictParameter()
Expand Down
141 changes: 92 additions & 49 deletions lbt_recipes/adaptive_comfort_map/flow/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import luigi
import os
from queenbee_local import QueenbeeTask
from .dependencies.main import _Main_8e859993Orchestrator as Main_8e859993Workerbee
from .dependencies.main import _Main_a5b4547cOrchestrator as Main_a5b4547cWorkerbee


_default_inputs = { 'comfort_parameters': '--standard ASHRAE-55',
Expand Down Expand Up @@ -153,6 +153,94 @@ def output(self):
}


class CopyGridInfo(QueenbeeTask):
"""Copy a file or folder to multiple destinations."""

# DAG Input parameters
_input_params = luigi.DictParameter()

# Task inputs
@property
def src(self):
value = self.input()['GetEnclosureInfo']['enclosure_list_file'].path.replace('\\', '/')
return value if os.path.isabs(value) \
else os.path.join(self.initiation_folder, value)

@property
def execution_folder(self):
return self._input_params['simulation_folder'].replace('\\', '/')

@property
def initiation_folder(self):
return self._input_params['simulation_folder'].replace('\\', '/')

@property
def params_folder(self):
return os.path.join(self.execution_folder, self._input_params['params_folder']).replace('\\', '/')

def command(self):
return 'echo copying input path...'

def requires(self):
return {'GetEnclosureInfo': GetEnclosureInfo(_input_params=self._input_params)}

def output(self):
return {
'dst_1': luigi.LocalTarget(
os.path.join(self.execution_folder, 'results/condition/grids_info.json')
),

'dst_2': luigi.LocalTarget(
os.path.join(self.execution_folder, 'results/condition_intensity/grids_info.json')
),

'dst_3': luigi.LocalTarget(
os.path.join(self.execution_folder, 'metrics/TCP/grids_info.json')
),

'dst_4': luigi.LocalTarget(
os.path.join(self.execution_folder, 'metrics/HSP/grids_info.json')
),

'dst_5': luigi.LocalTarget(
os.path.join(self.execution_folder, 'metrics/CSP/grids_info.json')
)
}

@property
def input_artifacts(self):
return [
{'name': 'src', 'to': 'input_path', 'from': self.src}]

@property
def output_artifacts(self):
return [
{
'name': 'dst-1', 'from': 'input_path',
'to': os.path.join(self.execution_folder, 'results/condition/grids_info.json')
},

{
'name': 'dst-2', 'from': 'input_path',
'to': os.path.join(self.execution_folder, 'results/condition_intensity/grids_info.json')
},

{
'name': 'dst-3', 'from': 'input_path',
'to': os.path.join(self.execution_folder, 'metrics/TCP/grids_info.json')
},

{
'name': 'dst-4', 'from': 'input_path',
'to': os.path.join(self.execution_folder, 'metrics/HSP/grids_info.json')
},

{
'name': 'dst-5', 'from': 'input_path',
'to': os.path.join(self.execution_folder, 'metrics/CSP/grids_info.json')
}]


class CreateModelOccSchedules(QueenbeeTask):
"""Translate a Model's occupancy schedules into a JSON of 0/1 values.
Expand Down Expand Up @@ -431,26 +519,6 @@ def output(self):
'enclosure_list_file': luigi.LocalTarget(
os.path.join(self.execution_folder, 'results/temperature/grids_info.json')
),

'enclosure_list_file': luigi.LocalTarget(
os.path.join(self.execution_folder, 'results/condition/grids_info.json')
),

'enclosure_list_file': luigi.LocalTarget(
os.path.join(self.execution_folder, 'results/condition_intensity/grids_info.json')
),

'enclosure_list_file': luigi.LocalTarget(
os.path.join(self.execution_folder, 'metrics/TCP/grids_info.json')
),

'enclosure_list_file': luigi.LocalTarget(
os.path.join(self.execution_folder, 'metrics/HSP/grids_info.json')
),

'enclosure_list_file': luigi.LocalTarget(
os.path.join(self.execution_folder, 'metrics/CSP/grids_info.json')
),
'enclosure_list': luigi.LocalTarget(
os.path.join(
self.params_folder,
Expand All @@ -474,31 +542,6 @@ def output_artifacts(self):
{
'name': 'enclosure-list-file', 'from': 'enclosure_list.json',
'to': os.path.join(self.execution_folder, 'results/temperature/grids_info.json')
},

{
'name': 'enclosure-list-file', 'from': 'enclosure_list.json',
'to': os.path.join(self.execution_folder, 'results/condition/grids_info.json')
},

{
'name': 'enclosure-list-file', 'from': 'enclosure_list.json',
'to': os.path.join(self.execution_folder, 'results/condition_intensity/grids_info.json')
},

{
'name': 'enclosure-list-file', 'from': 'enclosure_list.json',
'to': os.path.join(self.execution_folder, 'metrics/TCP/grids_info.json')
},

{
'name': 'enclosure-list-file', 'from': 'enclosure_list.json',
'to': os.path.join(self.execution_folder, 'metrics/HSP/grids_info.json')
},

{
'name': 'enclosure-list-file', 'from': 'enclosure_list.json',
'to': os.path.join(self.execution_folder, 'metrics/CSP/grids_info.json')
}]

@property
Expand Down Expand Up @@ -874,7 +917,7 @@ def map_dag_inputs(self):
return inputs

def run(self):
yield [Main_8e859993Workerbee(_input_params=self.map_dag_inputs)]
yield [Main_a5b4547cWorkerbee(_input_params=self.map_dag_inputs)]
self._copy_output_artifacts(self.execution_folder)
self._copy_output_parameters(self.execution_folder)
with open(os.path.join(self.execution_folder, 'run_irradiance_simulation.done'), 'w') as out_file:
Expand Down Expand Up @@ -946,7 +989,7 @@ def output_artifacts(self):
}]


class _Main_e5f86d9eOrchestrator(luigi.WrapperTask):
class _Main_a18a5575Orchestrator(luigi.WrapperTask):
"""Runs all the tasks in this module."""
# user input for this module
_input_params = luigi.DictParameter()
Expand All @@ -958,4 +1001,4 @@ def input_values(self):
return params

def requires(self):
return [ComputeTcp(_input_params=self.input_values), CreateResultInfo(_input_params=self.input_values)]
return [ComputeTcp(_input_params=self.input_values), CopyGridInfo(_input_params=self.input_values), CreateResultInfo(_input_params=self.input_values)]
2 changes: 1 addition & 1 deletion lbt_recipes/adaptive_comfort_map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "MetaData",
"annotations": {},
"name": "adaptive-comfort-map",
"tag": "0.1.0",
"tag": "0.2.2",
"app_version": null,
"keywords": [
"honeybee",
Expand Down
2 changes: 1 addition & 1 deletion lbt_recipes/adaptive_comfort_map/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LetAdaptiveComfortMapFly(luigi.WrapperTask):
_input_params = luigi.DictParameter()

def requires(self):
yield [adaptive_comfort_map_workerbee._Main_e5f86d9eOrchestrator(_input_params=self._input_params)]
yield [adaptive_comfort_map_workerbee._Main_a18a5575Orchestrator(_input_params=self._input_params)]


def start(project_folder, user_values, workers):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ def output_parameters(self):
return [{'name': 'grids-list', 'from': 'output/grids_info.json', 'to': os.path.join(self.params_folder, 'output/grids_info.json')}]


class _AnnualRadiationRayTracing_8e859993Orchestrator(luigi.WrapperTask):
class _AnnualRadiationRayTracing_a5b4547cOrchestrator(luigi.WrapperTask):
"""Runs all the tasks in this module."""
# user input for this module
_input_params = luigi.DictParameter()
Expand Down
10 changes: 5 additions & 5 deletions lbt_recipes/pmv_comfort_map/flow/dependencies/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import luigi
import os
from queenbee_local import QueenbeeTask
from .dependencies.annual_radiation_ray_tracing import _AnnualRadiationRayTracing_8e859993Orchestrator as AnnualRadiationRayTracing_8e859993Workerbee
from .dependencies.annual_radiation_ray_tracing import _AnnualRadiationRayTracing_a5b4547cOrchestrator as AnnualRadiationRayTracing_a5b4547cWorkerbee


_default_inputs = { 'model': None,
Expand Down Expand Up @@ -118,7 +118,7 @@ def map_dag_inputs(self):
return inputs

def run(self):
yield [AnnualRadiationRayTracing_8e859993Workerbee(_input_params=self.map_dag_inputs)]
yield [AnnualRadiationRayTracing_a5b4547cWorkerbee(_input_params=self.map_dag_inputs)]
with open(os.path.join(self.execution_folder, 'annual_radiation_raytracing.done'), 'w') as out_file:
out_file.write('done!\n')

Expand Down Expand Up @@ -177,7 +177,7 @@ def output(self):


class CopyGridInfo(QueenbeeTask):
"""Copy files and folder."""
"""Copy a file or folder to a destination."""

# DAG Input parameters
_input_params = luigi.DictParameter()
Expand Down Expand Up @@ -229,7 +229,7 @@ def output_artifacts(self):


class CopySunUpHours(QueenbeeTask):
"""Copy files and folder."""
"""Copy a file or folder to a destination."""

# DAG Input parameters
_input_params = luigi.DictParameter()
Expand Down Expand Up @@ -699,7 +699,7 @@ def output_artifacts(self):
}]


class _Main_8e859993Orchestrator(luigi.WrapperTask):
class _Main_a5b4547cOrchestrator(luigi.WrapperTask):
"""Runs all the tasks in this module."""
# user input for this module
_input_params = luigi.DictParameter()
Expand Down
Loading

0 comments on commit 16ca70c

Please sign in to comment.