Skip to content

Commit

Permalink
v3.2.7: minor improvement in error handling and messages (#1338)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctuning-admin authored Oct 24, 2024
2 parents fae4468 + c98e246 commit 47536c4
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
3 changes: 3 additions & 0 deletions cm/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## V3.2.7
- minor improvement in error handling and messages

## V3.2.6
- Fix type of "unknown_keys" to list to be serializable
https://github.com/mlcommons/ck/issues/1335
Expand Down
2 changes: 1 addition & 1 deletion cm/cmind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Written by Grigori Fursin

__version__ = "3.2.6"
__version__ = "3.2.7"

from cmind.core import access
from cmind.core import x
Expand Down
15 changes: 15 additions & 0 deletions cm/cmind/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,21 @@ def run_experiment(argv = None):

return run(['run', 'experiment'] + argv)

############################################################
def run_ff(argv = None):
"""
"""

# Access CMX
if argv is None:
argv = sys.argv[1:]

x = 'lex'
if len(argv) >0 and argv[0].startswith('_misc'):
x = argv[0]

return runx(['run', 'f'+x+'.flow'] + argv)

############################################################
def parse(cmd):
"""
Expand Down
11 changes: 9 additions & 2 deletions cm/cmind/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ def errorx(self, r):
if 'warning' in r:
message = r.get('warning', '')
if message != '':
message = '\nCMX warning: ' + message.capitalize() + '!\n'
message = message[0].upper() + message[1:]
message = '\nCMX warning: ' + message + '!\n'
else:
module_path = r.get('module_path', '')
lineno = r.get('lineno', '')
Expand Down Expand Up @@ -195,10 +196,16 @@ def errorx(self, r):

if module_path != '' and lineno !='':
message += f' in {module_path} ({lineno}):\n\n'
text = r['error']
text = text[0].upper() + text[1:]

else:
message += ': '
text = r['error']

if not text.endswith('!'): text += '!'

message += r['error'] + '\n'
message += text + '\n'

sys.stderr.write(message)

Expand Down
3 changes: 2 additions & 1 deletion cm/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ def run(self):
"cm = cmind.cli:run",
"cmx = cmind.cli:runx",
"cmr = cmind.cli:run_script",
"fflow = cmind.cli:run_ff",
"cmrd = cmind.cli:docker_script",
"cmg = cmind.cli:gui_script",
"cme = cmind.cli:run_experiment"
]},
]},

zip_safe=False,

Expand Down

0 comments on commit 47536c4

Please sign in to comment.