Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further dev #5

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/codequality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: code_quality

on:
push:
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install prospector[with_everything]
pip install prospector[with-everything]
pip install prospector[with_bandit]
pip install prospector[with_mypy]
pip install prospector[with_pyroma]
pip install prospector[with_vulture]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Lint with prospector
working-directory: ./
run: |
prospector building_sizer_execution/
prospector building_sizer_preparation/
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,13 @@ dmypy.json

# Pyre type checker
.pyre/

/building_sizer_results/bs_request*
/building_sizer_execution/*.txt
/building_sizer_execution/*.prof
/building_sizer_preparation/bs_configs/
/building_sizer_preparation/bs_configs_for_testing/
/building_sizer_preparation/bs_job_arrays/
/building_sizer_preparation/bs_job_arrays_for_testing/

/cluster_requests/slurm_output_files
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
TimeSeriesRequest,
)

from building_sizer import individual_encoding, evolutionary_algorithm as evo_alg
from building_sizer_execution import (
individual_encoding,
evolutionary_algorithm as evo_alg,
)


@dataclasses_json.dataclass_json
Expand All @@ -38,6 +41,7 @@ class BuildingSizerRequest:
a single building sizer iteration. Can be used to create the request object
for the subsequent iteration.
"""

#: url for connection to the UTSP
url: str
#: password for the connection to the UTSP
Expand All @@ -62,7 +66,7 @@ class BuildingSizerRequest:
mutation_probability: float = 0.4
#: SizingOptions object, containing information for decoding and encoding individuals
options: individual_encoding.SizingOptions = dataclasses.field(
default=individual_encoding.SizingOptions()
default_factory=individual_encoding.SizingOptions()
)

# parameters for HiSim
Expand Down Expand Up @@ -243,8 +247,8 @@ def decide_on_mode(
iteration_in_subiteration = iteration % (boolean_iterations + discrete_iterations)
if iteration_in_subiteration > discrete_iterations:
return "bool"
else:
return "discrete"

return "discrete"


def building_sizer_iteration(
Expand Down Expand Up @@ -337,7 +341,7 @@ def main():

# Read the request file
input_path = "/input/request.json"
with open(input_path) as input_file:
with open(input_path, "r", encoding="utf-8") as input_file:
request_json = input_file.read()
request: BuildingSizerRequest = BuildingSizerRequest.from_json(request_json) # type: ignore
# Check if there are hisim requests from previous iterations
Expand All @@ -357,7 +361,7 @@ def main():
building_sizer_result = BuildingSizerResult(finished, next_request, result)
building_sizer_result_json = building_sizer_result.to_json() # type: ignore

with open("/results/status.json", "w+") as result_file:
with open("/results/status.json", "w+", encoding="utf-8") as result_file:
result_file.write(building_sizer_result_json)


Expand Down
Loading
Loading