Skip to content

Commit

Permalink
[FEATURE] Adding sandbox_path as a new property
Browse files Browse the repository at this point in the history
  • Loading branch information
PauAndrio committed Jun 14, 2024
1 parent 134609c commit 3e64bed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions biobb_common/configuration/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def get_prop_dic(self, prefix: Optional[str] = None, global_log: Optional[loggin
| **global_log** (*Logger object*): Log from the main workflow.
| **restart** (*bool*): Restart from previous execution.
| **remove_tmp** (*bool*): Remove temporal files.
| **sandbox_path** (*str*) - ("./") Parent path to the sandbox directory.
Args:
prefix (str): Prefix if provided.
Expand Down Expand Up @@ -161,6 +162,7 @@ def get_prop_dic(self, prefix: Optional[str] = None, global_log: Optional[loggin
prop_dic["working_dir_path"] = self.properties.get("working_dir_path")
prop_dic["restart"] = self.properties.get("restart", False)
prop_dic["remove_tmp"] = self.properties.get("remove_tmp", True)
prop_dic["sandbox_path"] = self.properties.get("sandbox_path", Path.cwd())

if "properties" in self.properties and isinstance(
self.properties["properties"], dict
Expand Down
6 changes: 4 additions & 2 deletions biobb_common/generic/biobb_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class BiobbObject:
Args:
properties (dict - Python dictionary object containing the tool parameters, not input/output files):
* **sandbox_path** (*str*) - ("./") Parent path to the sandbox directory.
* **disable_sandbox** (*bool*) - (False) Disable the use of temporal unique directories aka sandbox. Only for local execution.
* **chdir_sandbox** (*bool*) - (False) Change directory to the sandbox using just file names in the command line. Only for local execution.
* **dev** (*str*) - (None) Adding additional options to command line.
Expand Down Expand Up @@ -59,9 +60,10 @@ def __init__(self, properties=None, **kwargs) -> None: # type: ignore

# stage
self.stage_io_dict: Dict[str, Any] = {"in": {}, "out": {}}
self.sandbox_path: Union[str, Path] = properties.get("sandbox_path", Path().cwd())
self.disable_sandbox: bool = properties.get("disable_sandbox", False)

# Properties common in all BB
self.disable_sandbox: bool = properties.get("disable_sandbox", False)
self.chdir_sandbox: bool = properties.get("chdir_sandbox", False)
self.binary_path: str = properties.get("binary_path", '')
self.can_write_console_log: bool = properties.get(
Expand Down Expand Up @@ -180,7 +182,7 @@ def stage_files(self):
self.stage_io_dict["unique_dir"] = os.getcwd()
return

unique_dir = str(Path(fu.create_unique_dir()).resolve())
unique_dir = str(Path(fu.create_unique_dir(path=str(self.sandbox_path), prefix="sandbox_", out_log=self.out_log)).resolve())
self.stage_io_dict = {"in": {}, "out": {}, "unique_dir": unique_dir}

# IN files COPY and assign INTERNAL PATH
Expand Down

0 comments on commit 3e64bed

Please sign in to comment.