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

Convert to string fix #1962

Merged
merged 2 commits into from
Oct 12, 2017
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
6 changes: 3 additions & 3 deletions scripts/lib/CIME/SystemTests/erp.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def _case_two_setup(self):
nthreads = self._case1.get_value("NTHRDS_{}".format(comp))
rootpe = self._case1.get_value("ROOTPE_{}".format(comp))
if ( nthreads > 1 ):
self._case.set_value("NTHRDS_{}".format(comp), nthreads/2)
self._case.set_value("NTHRDS_{}".format(comp), int(nthreads/2))
if ( ntasks > 1 ):
self._case.set_value("NTASKS_{}".format(comp), ntasks/2)
self._case.set_value("ROOTPE_{}".format(comp), rootpe/2)
self._case.set_value("NTASKS_{}".format(comp), int(ntasks/2))
self._case.set_value("ROOTPE_{}".format(comp), int(rootpe/2))

RestartTest._case_two_setup(self)
# Note, some components, like CESM-CICE, have
Expand Down
16 changes: 12 additions & 4 deletions scripts/lib/CIME/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def run_cmd(cmd, input_str=None, from_dir=None, verbose=None,
arg_stdout.close() # pylint: disable=no-member
if isinstance(arg_stderr, io.IOBase) and arg_stderr is not arg_stdout:
arg_stderr.close() # pylint: disable=no-member


if (verbose != False and (verbose or logger.isEnabledFor(logging.DEBUG))):
if stat != 0:
Expand Down Expand Up @@ -342,7 +342,7 @@ def check_minimum_python_version(major, minor):
>>> check_minimum_python_version(sys.version_info[0], sys.version_info[1])
>>>
"""
expect(sys.version_info[0] > major or
expect(sys.version_info[0] > major or
(sys.version_info[0] == major and sys.version_info[1] >= minor),
"Python {:d}, minor version {:d}+ is required, you have {:d}.{:d}".format(major, minor, sys.version_info[0], sys.version_info[1]))

Expand Down Expand Up @@ -868,8 +868,16 @@ def convert_to_string(value, type_str=None, vid=""):
"""
Convert value back to string.
vid is only for generating better error messages.
>>> convert_to_string(6, type_str="integer") == '6'
True
>>> convert_to_string('6', type_str="integer") == '6'
True
>>> convert_to_string('6.0', type_str="real") == '6.0'
True
>>> convert_to_string(6.01, type_str="real") == '6.01'
True
"""
if value is not None and type(value) is not str:
if value is not None and not isinstance(value, six.string_types):
if type_str == "char":
expect(isinstance(value, six.string_types), "Wrong type for entry id '{}'".format(vid))
elif type_str == "integer":
Expand Down Expand Up @@ -1302,7 +1310,7 @@ def is_python_executable(filepath):
first_line = f.readline()
except:
pass

return first_line is not None and first_line.startswith("#!") and "python" in first_line
return False

Expand Down