Fixed comments bug with obi head and obi tail
This commit is contained in:
6
python/obitools3/commands/head.pyx
Normal file → Executable file
6
python/obitools3/commands/head.pyx
Normal file → Executable file
@ -65,14 +65,14 @@ def run(config):
|
||||
|
||||
# Save command config in View comments
|
||||
command_line = " ".join(sys.argv[1:])
|
||||
comments = View.print_config(config, "head", command_line, input_dms_name=[i_dms.name], input_view_name=[i_view.name])
|
||||
|
||||
comments = View.get_config_dict(config, "head", command_line, input_dms_name=[i_dms.name], input_view_name=[i_view.name])
|
||||
|
||||
# Create output view with the line selection
|
||||
try:
|
||||
o_view = selection.materialize(output_view_name, comments=comments)
|
||||
except Exception, e:
|
||||
raise RollbackException("obi head error, rollbacking view: "+str(e), o_view)
|
||||
|
||||
|
||||
# TODO DISCUSS if output URI to different DMS, copy view?
|
||||
|
||||
# Save command config in DMS comments
|
||||
|
2
python/obitools3/commands/tail.pyx
Normal file → Executable file
2
python/obitools3/commands/tail.pyx
Normal file → Executable file
@ -65,7 +65,7 @@ def run(config):
|
||||
|
||||
# Save command config in View comments
|
||||
command_line = " ".join(sys.argv[1:])
|
||||
comments = View.print_config(config, "tail", command_line, input_dms_name=[i_dms.name], input_view_name=[i_view.name])
|
||||
comments = View.get_config_dict(config, "tail", command_line, input_dms_name=[i_dms.name], input_view_name=[i_view.name])
|
||||
|
||||
# Create output view with the line selection
|
||||
try:
|
||||
|
11
python/obitools3/dms/view/view.pyx
Normal file → Executable file
11
python/obitools3/dms/view/view.pyx
Normal file → Executable file
@ -397,6 +397,15 @@ cdef class View(OBIWrapper) :
|
||||
# Convert to json string
|
||||
comments_json = json.dumps(config_dict)
|
||||
return str2bytes(comments_json)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_config_dict(dict config, str command_name, str command_line, list input_str=None, list input_dms_name=None, list input_view_name=None):
|
||||
config_dict = View._config_to_dict(config, command_name, command_line, \
|
||||
input_str=input_str, input_dms_name=input_dms_name, input_view_name=input_view_name)
|
||||
# Clean virtually empty values
|
||||
config_dict = clean_empty_values_from_object(config_dict, exclude=[View_comments.KEEP_KEYS])
|
||||
return config_dict
|
||||
|
||||
|
||||
@OBIWrapper.checkIsActive
|
||||
@ -611,7 +620,7 @@ cdef class View_comments(dict): # Not thread safe
|
||||
comments_json = <bytes> view_p.infos.comments
|
||||
comments_json_str = bytes2str(comments_json)
|
||||
comments_dict = json.loads(comments_json_str)
|
||||
str2bytes_object(comments_dict)
|
||||
comments_dict = str2bytes_object(comments_dict)
|
||||
super(View_comments, self).update(comments_dict)
|
||||
|
||||
def __getitem__(self, object key):
|
||||
|
Reference in New Issue
Block a user