mdsplus icon indicating copy to clipboard operation
mdsplus copied to clipboard

Writing to the "current shot" (shot # = 0) via thick-client does not work

Open mwinkel-dev opened this issue 11 months ago • 3 comments

Affiliation PPPL @mwinkel-dev submitted this on behalf of @kgerickson

Version(s) Affected stable 7.132.0

Platform RHEL (which version?)

Describe the bug Need the ability to write to the "current shot" (i.e., shot number 0) via thick-client.

To Reproduce Steps to reproduce the behavior:

$ # On a server running mdsipd that uses /tmp/trees, do the following . . .
$ 
$ export default_tree_path=/tmp/trees
$ mdstcl
TCL> set current stuff 1
TCL> edit stuff /shot=0 /new
TCL> add node num1 /usage=numeric
TCL> write
TCL> close
TCL> quit
$ 
$ # Now switch to thick-client
$ export default_tree_path=<server_name>::
$
$ # And used the Python Objects API
$ python3
Python 3.8.10 (default, Nov 22 2023, 10:22:35) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import MDSplus as mds
>>> t = mds.Tree('stuff', 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/.../python/MDSplus/tree.py", line 559, in __init__
    self.open(mode)
  File "/home/.../python/MDSplus/tree.py", line 531, in open
    _exc.checkStatus(status)
  File "/home/.../python/MDSplus/mdsExceptions.py", line 94, in checkStatus
    raise exception
MDSplus.mdsExceptions.TreeNOCURRENT: %TREE-E-NOCURRENT, No current shot number set for this tree.
>>> quit()

Expected behavior The current shot (i.e., shot 001 in the above example) is opened and can be written to.

Screenshots n/a

Additional context n/a

mwinkel-dev avatar Mar 03 '24 00:03 mwinkel-dev

Investigation reveals that this is a bug in stable-7.132.0. And does not exist in alpha-7-140-68 (because it contains PR #2418 and PR #2723).

mwinkel-dev avatar Mar 05 '24 00:03 mwinkel-dev

The following output is from experiments with alpha-7-140-68 showing that the "current shot" (i.e., shot=0) works.

=== TCL ===

$
$ export junk_path=<some_server>::
$
$ mdstcl
TCL> set current junk 1
TCL> show current junk
Current shot is 1
TCL> set current junk /inc
TCL> show current junk
Current shot is 2
TCL> edit junk /shot=0 /new
TCL> add node num2
TCL> write
TCL> close
TCL> set current junk /inc
TCL> edit junk /shot=0 /new
TCL> add node num3
TCL> write
TCL> close
TCL> set current junk /inc
TCL> edit junk /shot=0 /new
TCL> add node num4
TCL> write
TCL> close
TCL> quit
$
$ ls
junk_002.characteristics  junk_002.tree		    junk_003.datafile  junk_004.characteristics  junk_004.tree
junk_002.datafile	  junk_003.characteristics  junk_003.tree      junk_004.datafile	 shotid.sys


=== Python Objects ===

$ mdstcl
TCL> set current junk /inc
TCL> show current junk
Current shot is 5
TCL> quit
$ python3
Python 3.8.10 (default, Nov 22 2023, 10:22:35) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import MDSplus as mds
>>> t = mds.Tree('junk', 0, 'new')
>>> t.write()
>>> t.close()
>>> quit()
$ ls
junk_002.characteristics  junk_003.characteristics  junk_004.characteristics  junk_005.characteristics	shotid.sys
junk_002.datafile	  junk_003.datafile	    junk_004.datafile	      junk_005.datafile
junk_002.tree		  junk_003.tree		    junk_004.tree	      junk_005.tree


=== Python thin-client ===

$ mdstcl
TCL> set current junk /inc
TCL> show current junk
Current shot is 6
TCL> set tree junk /shot=2
TCL> create pulse 0
TCL> write
TCL> close
TCL> quit

$ python3
Python 3.8.10 (default, Nov 22 2023, 10:22:35) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import MDSplus as mds
>>> t = conn.openTree('junk', 0)
>>> conn.closeTree('junk', 0)
>>> quit()

mwinkel-dev avatar Mar 05 '24 00:03 mwinkel-dev

Hi @kgerickson -- As mentioned above, this problem should vanish when you receive a stable that includes PR #2418 and PR #2723. Let me know if you want me to do any additional testing of this issue.

mwinkel-dev avatar Mar 05 '24 00:03 mwinkel-dev