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

renaming parent path #427

Merged
merged 1 commit into from
Jan 13, 2025
Merged
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
16 changes: 8 additions & 8 deletions alphadia/workflow/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def __init__(

"""
self._instance_name: str = instance_name
self._parent_path: str = quant_path or os.path.join(
self._quant_path: str = quant_path or os.path.join(
config[ConfigKeys.OUTPUT_DIRECTORY], QUANT_FOLDER_NAME
)
logger.info(f"Saving quantification results to {self._parent_path}")
logger.info(f"Saving quantification results to {self._quant_path}")

self._config: Config = config
self.reporter: reporting.Pipeline | None = None
Expand All @@ -68,9 +68,9 @@ def __init__(
self._optimization_manager: manager.OptimizationManager | None = None
self._timing_manager: manager.TimingManager | None = None

if not os.path.exists(self.parent_path):
logger.info(f"Creating parent folder for workflows at {self.parent_path}")
os.makedirs(self.parent_path)
if not os.path.exists(self._quant_path):
logger.info(f"Creating parent folder for workflows at {self._quant_path}")
os.makedirs(self._quant_path)

if not os.path.exists(self.path):
logger.info(
Expand Down Expand Up @@ -143,14 +143,14 @@ def instance_name(self) -> str:
return self._instance_name

@property
def parent_path(self) -> str:
def quant_path(self) -> str:
"""Path where the workflow folder will be created"""
return self._parent_path
return self._quant_path

@property
def path(self) -> str:
"""Path to the workflow folder"""
return os.path.join(self.parent_path, self.instance_name)
return os.path.join(self._quant_path, self.instance_name)

@property
def config(self) -> Config:
Expand Down
6 changes: 3 additions & 3 deletions tests/unit_tests/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,11 @@ def test_workflow_base():

assert my_workflow.config["output_directory"] == config["output_directory"]
assert my_workflow.instance_name == workflow_name
assert my_workflow.parent_path == os.path.join(
assert my_workflow.quant_path == os.path.join(
config["output_directory"], base.QUANT_FOLDER_NAME
)
assert my_workflow.path == os.path.join(
my_workflow.parent_path, workflow_name
my_workflow.quant_path, workflow_name
)

assert os.path.exists(my_workflow.path)
Expand All @@ -355,7 +355,7 @@ def test_workflow_base():

# os.rmdir(os.path.join(my_workflow.path, my_workflow.FIGURE_PATH))
# os.rmdir(os.path.join(my_workflow.path))
shutil.rmtree(os.path.join(my_workflow.parent_path))
shutil.rmtree(os.path.join(my_workflow.quant_path))


FDR_TEST_BASE_CLASSIFIER = BinaryClassifierLegacyNewBatching(
Expand Down
Loading