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

create newcase script root option #1438

Merged
merged 3 commits into from
May 2, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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
18 changes: 13 additions & 5 deletions scripts/create_newcase
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ OR
parser.add_argument("--output-root",
help="Alternative path for the directory where case output is written")

parser.add_argument("--script-root", dest="script_root", default=None,
help="Alternative path for the directory where the cime scripts are written")

if model == "cesm":
parser.add_argument("--run-unsupported", action="store_true",
help="Force the creation of a case not tested or supported by CESM developers")
Expand Down Expand Up @@ -160,20 +163,25 @@ OR
args.mpilib, args.project, args.pecount, \
args.user_mods_dir, args.user_compset, args.pesfile, \
args.user_grid, args.gridfile, args.srcroot, args.test, args.ninst, \
args.walltime, args.queue, args.output_root, run_unsupported, args.answer, args.input_dir
args.walltime, args.queue, args.output_root, args.script_root, \
run_unsupported, args.answer, args.input_dir

###############################################################################
def _main_func(description):
###############################################################################
cimeroot = os.path.abspath(CIME.utils.get_cime_root())

caseroot, compset, grid, machine, compiler, \
casename, compset, grid, machine, compiler, \
mpilib, project, pecount, \
user_mods_dir, user_compset, pesfile, \
user_grid, gridfile, srcroot, test, ninst, walltime, queue, \
output_root, run_unsupported, answer, input_dir = parse_command_line(sys.argv, cimeroot, description)
output_root, script_root, run_unsupported, \
answer, input_dir = parse_command_line(sys.argv, cimeroot, description)

caseroot = os.path.abspath(caseroot)
if script_root is None:
caseroot = os.path.abspath(casename)
else:
caseroot = os.path.abspath(script_root)

# create_test creates the caseroot before calling create_newcase
# otherwise throw an error if this directory exists
Expand All @@ -182,7 +190,7 @@ def _main_func(description):

with Case(caseroot, read_only=False) as case:
# Set values for env_case.xml
case.set_lookup_value("CASE", os.path.basename(caseroot))
case.set_lookup_value("CASE", os.path.basename(casename))
case.set_lookup_value("CASEROOT", caseroot)
case.set_lookup_value("SRCROOT", srcroot)

Expand Down
2 changes: 1 addition & 1 deletion scripts/tests/scripts_regression_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def test_a_createnewcase(self):
shutil.rmtree(testdir)

cls._testdirs.append(testdir)
run_cmd_assert_result(self, "%s/create_newcase --case %s --compset X --res f19_g16 --output-root %s" % (SCRIPT_DIR, testdir, cls._testroot), from_dir=SCRIPT_DIR)
run_cmd_assert_result(self, "%s/create_newcase --case CreateNewcaseTest --script-root %s --compset X --res f19_g16 --output-root %s" % (SCRIPT_DIR, testdir, cls._testroot), from_dir=SCRIPT_DIR)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a couple tests to verify the directory structure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do that later today. Would you want me to emulate the structure that the coupled team wants, or is just leaving it the way it is fine?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be the structure created by the values given to the optional arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the tests for the directory structure; is this ready?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

run_cmd_assert_result(self, "./case.setup", from_dir=testdir)
run_cmd_assert_result(self, "./case.build", from_dir=testdir)

Expand Down