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

refac: Reorganize folders #53

Merged
merged 55 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
99f8c85
Update metering_point_periods_v1.py
johevemi Dec 20, 2024
a3f23f5
.
johevemi Dec 20, 2024
ddefa28
.
johevemi Dec 20, 2024
145760f
.
johevemi Dec 20, 2024
c3c3cad
Revert "."
johevemi Dec 20, 2024
38618d8
Revert "."
johevemi Dec 20, 2024
01e5f87
Revert "."
johevemi Dec 20, 2024
cfbbf3c
Revert "Update metering_point_periods_v1.py"
johevemi Dec 20, 2024
e78861d
Merge branch 'main' into reorganize-folders
johevemi Dec 20, 2024
ce82beb
.
johevemi Dec 20, 2024
27ba8e0
Merge branch 'main' into reorganize-folders
johevemi Dec 20, 2024
b54d26e
.
johevemi Dec 23, 2024
a40ecac
.
johevemi Dec 23, 2024
f626efa
.
johevemi Dec 23, 2024
efb12d5
Update electrical_heating_job_args.py
johevemi Dec 23, 2024
8eea8a7
Merge branch 'main' into reorganize-folders
johevemi Dec 23, 2024
685f937
.
johevemi Dec 23, 2024
b9edade
Merge branch 'reorganize-folders' of https://github.com/Energinet-Dat…
johevemi Dec 23, 2024
ecca26e
.
johevemi Dec 23, 2024
fd1c9bf
.
johevemi Dec 23, 2024
7bfc65a
.
johevemi Dec 23, 2024
7943172
Update ci-capacity-settlement.yml
johevemi Dec 23, 2024
bdc206a
.
johevemi Dec 23, 2024
18a157d
Update entry_point.py
johevemi Dec 23, 2024
9daff08
.
johevemi Dec 23, 2024
a216cb4
Update ci-capacity-settlement.yml
johevemi Dec 23, 2024
3776047
Update test_capacity_settlement_job_args.py
johevemi Dec 23, 2024
3710538
Update conftest.py
johevemi Dec 23, 2024
7cc8bc7
Update conftest.py
johevemi Dec 23, 2024
0e3bffb
Update test_entry_points.py
johevemi Dec 23, 2024
8e6212d
.
johevemi Dec 23, 2024
884afad
Update ci-electrical-heating.yml
johevemi Dec 23, 2024
f1c9b69
Update entry_point.py
johevemi Dec 23, 2024
00c0f16
Update conftest.py
johevemi Dec 23, 2024
d805054
Update calculation.py
johevemi Dec 23, 2024
6ada036
Update entry_point.py
johevemi Dec 23, 2024
cc90c15
Update calculation.py
johevemi Dec 23, 2024
a957339
Update calculation.py
johevemi Dec 23, 2024
b93c022
Merge branch 'main' into reorganize-folders
johevemi Dec 23, 2024
685fba2
Update calculation.py
johevemi Dec 23, 2024
c5be07d
Update calculation.py
johevemi Dec 23, 2024
5d9bffd
Update calculation.py
johevemi Dec 23, 2024
5cb1286
.........
johevemi Dec 23, 2024
ecc6365
Update entry_point.py
johevemi Dec 23, 2024
97b0c21
Update test_electrical_heating_job_args.py
johevemi Dec 23, 2024
6ffbb52
Update electrical_heating_job_args.py
johevemi Dec 23, 2024
06820e9
t
johevemi Dec 23, 2024
86edb28
Revert "t"
johevemi Dec 23, 2024
777ed59
Update entry_point.py
johevemi Dec 23, 2024
0cc097b
Update entry_point.py
johevemi Dec 23, 2024
e4fc511
?
johevemi Dec 27, 2024
f1a8386
Update ci-capacity-settlement.yml
johevemi Dec 27, 2024
c6e5d53
Update ci-capacity-settlement.yml
johevemi Dec 27, 2024
0d56ed0
Update entry_point.py
johevemi Dec 27, 2024
a0218b4
Merge branch 'main' into reorganize-folders
energinet-ajw Jan 2, 2025
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
4 changes: 1 addition & 3 deletions .github/workflows/ci-capacity-settlement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
with:
python_version: 3.11.7
architecture: x64
wheel_working_directory: ./source/capacity_settlement
wheel_working_directory: ./source/capacity_settlement/src
prerelease_prefix: capacity_settlement

unit_tests:
Expand All @@ -23,7 +23,6 @@ jobs:
# IMPORTANT: When adding a new folder here it should also be added in the `unit_test_check` job!
tests_filter_expression:
- name: Capacity Settlement
paths: capacity_settlement_tests/
uses: Energinet-DataHub/.github/.github/workflows/python-ci.yml@v14
with:
job_name: ${{ matrix.tests_filter_expression.name }}
Expand Down Expand Up @@ -62,7 +61,6 @@ jobs:
# to one of the test jobs above! This is because this filter contains the sum of all folders
# from test jobs.
test_path="source/capacity_settlement/tests/"
filter="capacity_settlement_tests/"

chmod +x ./.devcontainer/check_test_count.sh
IMAGE_TAG=${{ inputs.image_tag }} docker compose -f .devcontainer/docker-compose.yml run --rm -u root python-unit-test ./.devcontainer/check_test_count.sh $test_path $filter
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/ci-electrical-heating.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
with:
python_version: 3.11.7
architecture: x64
wheel_working_directory: ./source/electrical_heating
wheel_working_directory: ./source/electrical_heating/src
prerelease_prefix: electrical_heating

unit_tests:
Expand All @@ -23,7 +23,6 @@ jobs:
# IMPORTANT: When adding a new folder here it should also be added in the `unit_test_check` job!
tests_filter_expression:
- name: Electrical Heating
paths: electrical_heating_tests/
uses: Energinet-DataHub/.github/.github/workflows/python-ci.yml@v14
with:
job_name: ${{ matrix.tests_filter_expression.name }}
Expand Down Expand Up @@ -57,7 +56,6 @@ jobs:
# to one of the test jobs above! This is because this filter contains the sum of all folders
# from test jobs.
test_path="source/electrical_heating/tests/"
filter="electrical_heating_tests/"

chmod +x ./.devcontainer/check_test_count.sh
IMAGE_TAG=${{ inputs.image_tag }} docker compose -f .devcontainer/docker-compose.yml run --rm -u root python-unit-test ./.devcontainer/check_test_count.sh $test_path $filter
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from opentelemetry.trace import SpanKind
from telemetry_logging.span_recording import span_record_exception

from capacity_settlement.entry_points.job_args.capacity_settlement_args import (
from source.capacity_settlement.src.capacity_settlement.entry_points.job_args.capacity_settlement_args import (
CapacitySettlementArgs,
)
from capacity_settlement.entry_points.job_args.capacity_settlement_job_args import (
from source.capacity_settlement.src.capacity_settlement.entry_points.job_args.capacity_settlement_job_args import (
parse_command_line_arguments,
parse_job_arguments,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import pytest

from capacity_settlement.entry_points.job_args.capacity_settlement_job_args import (
from source.capacity_settlement.src.capacity_settlement.entry_points.job_args.capacity_settlement_job_args import (
parse_command_line_arguments,
parse_job_arguments,
)
from capacity_settlement.entry_points.job_args.environment_variables import (
from source.capacity_settlement.src.capacity_settlement.entry_points.job_args.environment_variables import (
EnvironmentVariable,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import pytest

from electrical_heating import entry_points as module
from test_common.entry_points.entry_point_test_util import assert_entry_point_exists
from source.capacity_settlement.src.capacity_settlement import entry_points as module
from source.capacity_settlement.test_common.entry_points.entry_point_test_util import (
assert_entry_point_exists,
)


@pytest.mark.parametrize(
Expand Down
2 changes: 1 addition & 1 deletion source/capacity_settlement/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def capacity_settlement_path(source_path: str) -> str:
`os.chdir()`. The correctness also relies on the prerequisite that this function is
actually located in a file located directly in the tests folder.
"""
return f"{source_path}/capacity_settlement"
return f"{source_path}/capacity_settlement/src"


@pytest.fixture(scope="session")
Expand Down
4 changes: 0 additions & 4 deletions source/electrical_heating/electrical_heating/__init__.py

This file was deleted.

Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
import pyspark.sql.functions as F
from telemetry_logging import use_span

from electrical_heating.domain.pyspark_functions import (
convert_utc_to_localtime,
from source.electrical_heating.src.electrical_heating.domain.pyspark_functions import (
convert_localtime_to_utc,
convert_utc_to_localtime,
)
import electrical_heating.infrastructure.measurements_gold as mg
import electrical_heating.infrastructure.electricity_market as em
from electrical_heating.entry_points.job_args.electrical_heating_args import (
from source.electrical_heating.src.electrical_heating.entry_points.job_args.electrical_heating_args import (
ElectricalHeatingArgs,
)

from source.electrical_heating.src.electrical_heating.infrastructure import (
electricity_market as em,
measurements_gold as mg,
)


@use_span()
def execute(spark: SparkSession, args: ElectricalHeatingArgs) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
from opentelemetry.trace import SpanKind
from telemetry_logging.span_recording import span_record_exception

from electrical_heating.domain import calculation
from electrical_heating.entry_points.job_args.electrical_heating_args import (
from source.electrical_heating.src.electrical_heating.domain import calculation


from source.electrical_heating.src.electrical_heating.entry_points.job_args.electrical_heating_args import (
ElectricalHeatingArgs,
)
from electrical_heating.entry_points.job_args.electrical_heating_job_args import (
from source.electrical_heating.src.electrical_heating.entry_points.job_args.electrical_heating_job_args import (
parse_command_line_arguments,
parse_job_arguments,
)
from electrical_heating.infrastructure.spark_initializor import initialize_spark
from source.electrical_heating.src.electrical_heating.infrastructure.spark_initializor import (
initialize_spark,
)


def execute() -> None:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from telemetry_logging import Logger, logging_configuration

from .electrical_heating_args import ElectricalHeatingArgs
import electrical_heating.entry_points.job_args.environment_variables as env_vars
from .environment_variables import get_catalog_name, get_time_zone


def parse_command_line_arguments() -> Namespace:
Expand All @@ -21,9 +21,9 @@ def parse_job_arguments(
with logging_configuration.start_span("electrical_heating.parse_job_arguments"):

electrical_heating_args = ElectricalHeatingArgs(
catalog_name=env_vars.get_catalog_name(),
catalog_name=get_catalog_name(),
orchestration_instance_id=job_args.orchestration_instance_id,
time_zone=env_vars.get_time_zone(),
time_zone=get_time_zone(),
)

return electrical_heating_args
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pyspark.sql import SparkSession, DataFrame

from electrical_heating.infrastructure.electricity_market.database_definitions import (
from source.electrical_heating.src.electrical_heating.infrastructure.electricity_market.database_definitions import (
Database,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pyspark.sql import DataFrame

from electrical_heating.infrastructure.measurements_bronze.database_definitions import (
from source.electrical_heating.src.electrical_heating.infrastructure.measurements_bronze.database_definitions import (
MeasurementsBronzeDatabase,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pyspark.sql import SparkSession, DataFrame

from electrical_heating.infrastructure.measurements_gold.database_definitions import (
from source.electrical_heating.src.electrical_heating.infrastructure.measurements_gold.database_definitions import (
Database,
)

Expand Down
2 changes: 1 addition & 1 deletion source/electrical_heating/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def electrical_heating_path(source_path: str) -> str:
`os.chdir()`. The correctness also relies on the prerequisite that this function is
actually located in a file located directly in the tests folder.
"""
return f"{source_path}/electrical_heating"
return f"{source_path}/electrical_heating/src"


@pytest.fixture(scope="session")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

import pytest

from electrical_heating.entry_points.job_args.electrical_heating_job_args import (

from source.electrical_heating.src.electrical_heating.entry_points.job_args.environment_variables import (
EnvironmentVariable,
)
from source.electrical_heating.src.electrical_heating.entry_points.job_args.electrical_heating_job_args import (
parse_command_line_arguments,
parse_job_arguments,
)
from electrical_heating.entry_points.job_args.environment_variables import (
EnvironmentVariable,
)

DEFAULT_ORCHESTRATION_INSTANCE_ID = "12345678-9fc8-409a-a169-fbd49479d711"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import pytest

from capacity_settlement import entry_points as module
from test_common.entry_points.entry_point_test_util import assert_entry_point_exists
from source.electrical_heating.src.electrical_heating import entry_points as module
from source.electrical_heating.test_common.entry_points.entry_point_test_util import (
assert_entry_point_exists,
)


@pytest.mark.parametrize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
from telemetry_logging import logging_configuration
from testcommon.etl import read_csv, TestCase, TestCases

from electrical_heating.domain.calculation import execute_core_logic
from electrical_heating.infrastructure.electricity_market.schemas.child_metering_point_periods_v1 import (
from source.electrical_heating.src.electrical_heating.domain.calculation import (
execute_core_logic,
)
from source.electrical_heating.src.electrical_heating.infrastructure.electricity_market.schemas.child_metering_point_periods_v1 import (
child_metering_point_periods_v1,
)
from electrical_heating.infrastructure.electricity_market.schemas.consumption_metering_point_periods_v1 import (
from source.electrical_heating.src.electrical_heating.infrastructure.electricity_market.schemas.consumption_metering_point_periods_v1 import (
consumption_metering_point_periods_v1,
)
from electrical_heating.infrastructure.measurements_gold.schemas.time_series_points_v1 import (

from source.electrical_heating.src.electrical_heating.infrastructure.measurements_gold.schemas.time_series_points_v1 import (
time_series_points_v1,
)

Expand Down
Loading