Skip to content

Commit 202b547

Browse files
authored
Add Default Path (#12)
### Description <!---Why are we making this change? What does it do?---> title ### Testing <!---How was this tested?---> ![image](https://github.com/user-attachments/assets/3403dbfc-b8da-4ba0-af15-70c9a08e435d) ### Impact <!---What components does this impact? How can it affect prod?---> ### Other <!---What else can this impact? What special considerations are needed when reviewing the PR?--->
2 parents bb4c92b + c53dc8a commit 202b547

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ __pycache__
66
.ruff_cache
77
.mypy_cache
88
*.so
9+
dist

lens/core.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77
from lens.util.hostname import check_valid_lens_hostname, get_hostname
88
from lens.util.paths import check_file_structure_correct, check_metadata_exists, check_metadata_version_match
99

10+
DEFAULT_PATH = Path("/pool/lens")
11+
1012

1113
class Lens:
1214
def __init__(self) -> None:
1315
self.started = False
1416
self.descriptor: DataDescriptor
1517

16-
def startup(self, data_root: Path) -> None:
18+
def startup(self, data_root: Path | None) -> None:
19+
if data_root is None:
20+
logger.info("No path specified - falling back to default path.")
21+
data_root = DEFAULT_PATH
1722
self._startup_check_hostname()
1823
self._startup_check_metadata(data_root)
1924
self._startup_check_files(data_root)

lens/main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@
99

1010
def parse_arguments() -> Any:
1111
parser = argparse.ArgumentParser()
12-
parser.add_argument("-d", "--directory", type=str, required=True)
12+
parser.add_argument("-d", "--directory", type=str, required=False)
1313

1414
args = parser.parse_args()
1515
return args
1616

1717

1818
@logger.catch
19-
def main(data_root: Path) -> None:
19+
def main(data_root: Path | None) -> None:
2020
ln = Lens()
2121
logger.info("Starting lens initialization check.")
2222
ln.startup(data_root)
2323

2424

2525
if __name__ == "__main__":
2626
args = parse_arguments()
27-
data_root = Path(args.directory)
28-
main(data_root)
27+
specified_root = args.directory
28+
if specified_root is not None:
29+
specified_root = Path(specified_root)
30+
main(specified_root)

0 commit comments

Comments
 (0)