Documentation:TreeAccess - MdsWiki
Navigation
Personal tools

From MdsWiki

Jump to: navigation, search

Contents

Tree Access

MDSplus stores both configuration and data in a set of three files per shot/model (more). The files are located in dedicated folders on a file system and can be access either directly if local or via network connection and the mdsip protocol. The location of the files must be provided in form of environment variables (with the exception of the thin client which uses an explicit connection to an mdsip server, i.e. MdsConnect[TDI], MDSplus.Connection[python]). The tree paths can be defined statically or dynamically using '~' wildcards also all path location can be set up as ';' separated list (with limitations in case the old thick client is involved).

  • Using a static absolute path, e.g. for a tree called 'main':
 main_path=/path/to/files
  • Using an alias, e.g. if 'main' is an alias for 'realmain':
 main_path=ALIASrealmain
  • Using wildcards to a 10 digits long shot value (~[a-j]) and the tree name (~t), e.g. if tree 'main', shot 1234567890 should map to '/main/1/2/3/4/5/6/7/8/9/0':
 main_path=/~t/~j/~i/~h/~g/~f/~e/~d/~c/~b/~a

NOTE1: The ~[a-j] wildcards were implemented for accessing archived data. They will not work for creating shots.

NOTE2: Path definitions containing ~[a-j] wildcards will not match the model.

NOTE3: Use a script to create the required folder structure and to sort the new shots into the archive.

A typical tree path set could look like this:

 main_path=/trees/new/~t;/trees/model/~t;/trees/archive/~t/~i~h/~g~f/~e~d/
  • Using a TDI function 'main_tree_filename(IN _shot)'
 main_path=~n

- Where 'main_path_filename' should return the fullpath to the tree file without extension e.g. to map all shots to model:

 PUBLIC FUN MAIN_PATH_FILENAME(IN _SHOT) {
   RETURN("/path/to/main_model");
 }
  • Using a default tree location specifier 'default_tree_path' which may include any of the above techniques
 default_tree_path="/trees/~t;~n;/tmp"

NOTE: For features like current_shot to work per treename your path should contain at least one '~t' wildcard and its targets should contain the respective 'shotid.sys' file.

Remote Access

In the current alpha branch we improved the flexibility on how to connect to remote data servers, which is why some remote methods are only available if client and server run on newest alpha.

Direct Connection

If you are on the same network as the data server, e.g. 'target', you can directly connect to I via its host name appended by '::' for a thick client connection (practically as powerful as distributed client in newer alpha).

 main_path=target::

which is short for

 main_path=tcp://target:8000::

If you know the path to the tree files on the server you can use the distributed client which on older versions of MDSplus is superior compared to thick client (e.g. segment support).

 main_path=target::/path/to/files

Depending of the server i might be necessary to authenticate you identity for write or read and write access. I this case you may have to specify a different protocol, e.g. for ssh authentication:

 main_path=ssh://user@target::[/path/to/files]

ssh connections

IMPORTANT: It is recommended to setup passwordless authentication (e.g. via ssh-copy-id) and exercise the connection once thru shell before using it in MDSplus.
This is to avoid errors due to user interaction for password exchange or during hostkey checking.

Gateway Connection

In case you are not on the same network as the data server you may have the option to connect to a gateway e.g. via ssh which you then can use as a jump host. Depending the number jump hosts that is required to reach your target server you have a few options:
For situations where your jump hosts are running a recent version of alpha with active mdsipd you can chain thick clients definitions:

 main_path=gate1::gate2::target::[/path/to/files]

If you are only one jump host away from your target, your gateway allows ssh logins, and it has nc (or equivalent), you can setup a custom protocol 'mdsip-client-gate' and set your path to:

 main_path=gate://user@target::[/path/to/files]

If all jump hosts are accessed via ssh connections you can setup proxies for each one in you ~/.ssh/config file. E.g. for localhost->gate.domain.com->mds-term.domain.com->mds-data1:

 Host gate1
     HostName extgate.domain.com
 Host gate2
     ProxyCommand ssh -x -a -q gate nc intgate.domain.com 22'
 Host gate-target gate-target2
     ProxyCommand ssh -x -a -q gate-term nc $(echo %h|sed 's/gate-//') 22                # sed strips the 'gate-' away

and set your path to:

 main_path=ssh://user@gate-target::[/path/to/files]