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

v3.2.7: minor improvement in error handling and messages #1338

Merged
merged 5 commits into from
Oct 24, 2024
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
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
Loading