Skip to content

Commit 28e27a7

Browse files
committed
Harmonize default root var names across rimport and relink.
1 parent c965343 commit 28e27a7

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

relink.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import time
1313
from pathlib import Path
1414

15-
DEFAULT_SOURCE_ROOT = "/glade/campaign/cesm/cesmdata/cseg/inputdata/"
16-
DEFAULT_TARGET_ROOT = (
15+
DEFAULT_INPUTDATA_ROOT = "/glade/campaign/cesm/cesmdata/cseg/inputdata/"
16+
DEFAULT_STAGING_ROOT = (
1717
"/glade/campaign/collections/gdex/data/d651077/cesmdata/inputdata/"
1818
)
1919

@@ -131,7 +131,7 @@ def handle_non_dir(var, user_uid):
131131
return file_path
132132

133133

134-
def find_owned_files_scandir(item, user_uid, inputdata_root=DEFAULT_SOURCE_ROOT):
134+
def find_owned_files_scandir(item, user_uid, inputdata_root=DEFAULT_INPUTDATA_ROOT):
135135
"""
136136
Efficiently find all files owned by a specific user using os.scandir().
137137
@@ -178,7 +178,7 @@ def find_owned_files_scandir(item, user_uid, inputdata_root=DEFAULT_SOURCE_ROOT)
178178

179179

180180
def replace_files_with_symlinks(
181-
item_to_process, target_dir, username, inputdata_root=DEFAULT_SOURCE_ROOT, dry_run=False
181+
item_to_process, target_dir, username, inputdata_root=DEFAULT_INPUTDATA_ROOT, dry_run=False
182182
):
183183
"""
184184
Finds files owned by a specific user in a source directory tree,
@@ -334,19 +334,19 @@ def parse_arguments():
334334
parser.add_argument(
335335
"items_to_process",
336336
nargs="*",
337-
default=DEFAULT_SOURCE_ROOT,
337+
default=DEFAULT_INPUTDATA_ROOT,
338338
type=validate_paths,
339339
help=(
340-
f"One or more (directories to search for) files (default: {DEFAULT_SOURCE_ROOT})"
340+
f"One or more (directories to search for) files (default: {DEFAULT_INPUTDATA_ROOT})"
341341
),
342342
)
343343
parser.add_argument(
344344
"--target-root",
345345
type=validate_directory,
346-
default=DEFAULT_TARGET_ROOT,
346+
default=DEFAULT_STAGING_ROOT,
347347
help=(
348348
f"The root of the directory tree where files should be moved to "
349-
f"(default: {DEFAULT_TARGET_ROOT})"
349+
f"(default: {DEFAULT_STAGING_ROOT})"
350350
),
351351
)
352352

@@ -356,7 +356,7 @@ def parse_arguments():
356356
"--inputdata-root",
357357
"-inputdata", # to match rimport
358358
type=validate_directory,
359-
default=DEFAULT_SOURCE_ROOT,
359+
default=DEFAULT_INPUTDATA_ROOT,
360360
help=argparse.SUPPRESS,
361361
)
362362

rimport

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import sys
1616
from pathlib import Path
1717
from typing import Iterable, List
1818

19-
DEFAULT_SOURCE_ROOT = Path("/glade/campaign/cesm/cesmdata/cseg/inputdata")
19+
DEFAULT_INPUTDATA_ROOT = Path("/glade/campaign/cesm/cesmdata/cseg/inputdata")
2020
DEFAULT_STAGING_ROOT = Path(
2121
"/glade/campaign/collections/gdex/data/d651077/cesmdata/inputdata"
2222
)
@@ -50,10 +50,10 @@ def build_parser() -> argparse.ArgumentParser:
5050
"-inputdata",
5151
dest="inputdata",
5252
metavar="inputdata_dir",
53-
default=DEFAULT_SOURCE_ROOT,
53+
default=DEFAULT_INPUTDATA_ROOT,
5454
help=(
5555
"Change the default local top level inputdata directory."
56-
f" Default: '{DEFAULT_SOURCE_ROOT}'"
56+
f" Default: '{DEFAULT_INPUTDATA_ROOT}'"
5757
),
5858
)
5959

tests/relink/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def fixture_temp_dirs():
1616
source_dir = tempfile.mkdtemp(prefix="test_source_")
1717
target_dir = tempfile.mkdtemp(prefix="test_target_")
1818

19-
with patch("relink.DEFAULT_SOURCE_ROOT", source_dir):
20-
with patch("relink.DEFAULT_TARGET_ROOT", target_dir):
19+
with patch("relink.DEFAULT_INPUTDATA_ROOT", source_dir):
20+
with patch("relink.DEFAULT_STAGING_ROOT", target_dir):
2121
yield source_dir, target_dir
2222

2323
# Cleanup

tests/rimport/test_build_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def test_inputdata_default(self):
7272
"""Test that -inputdata has correct default value."""
7373
parser = rimport.build_parser()
7474
args = parser.parse_args(["-file", "test.txt"])
75-
assert args.inputdata == rimport.DEFAULT_SOURCE_ROOT
75+
assert args.inputdata == rimport.DEFAULT_INPUTDATA_ROOT
7676

7777
def test_inputdata_custom(self):
7878
"""Test that -inputdata can be customized."""

0 commit comments

Comments
 (0)