Project

General

Profile

Import Export Application Settings as json file » History » Version 6

Anchi Cheng, 02/02/2018 06:11 PM

1 1 Anchi Cheng
h1. Import Export Application Settings as json file
2
3
We have a pair python scripts used for exporting and importing application settings in your_myami/dbschema/tools.
4
You need to run this on your leginon linux station where leginon is installed so it can find the python library.
5
6
h2. Export to json file
7
8
Once you have a session that successfully use the settings that you would like to distribute
9
<pre>
10 6 Anchi Cheng
cd /your_myami/dbschema/tools
11 1 Anchi Cheng
python ./export_leginon_settings.py <sessionname> <optional partial application name> <optional node name prefix>
12
</pre>
13
14
The options means that you could export the settings specific to the application, or node.
15
16
h2. Import into database
17
18
The settings needed for the application can be imported into Leginon
19
<pre>
20 6 Anchi Cheng
cd /your_myami/dbschema/tools
21 2 Anchi Cheng
python ./import_leginon_settings.py <your_application name>
22 1 Anchi Cheng
</pre>
23 2 Anchi Cheng
It will prompt you for location of the settings json file if it can not find it automatically.
24
The default location of the file is /your_myami/leginon/applications/your_application.json
25 3 Anchi Cheng
26
h2. Edit json file for a different node name
27
28
If you copy an application with application editor and changed the node alias to match your local naming convention, the settings get default back to the class default.  You can modify the json file exported from the old application and modify it to match the new naming convention.
29
30
For example, the json section for "Presets Manager" is
31
<pre>
32
  {
33
    "PresetsManagerSettingsData":{
34
      "stage always":true,
35
      "name":"Presets Manager",
36
      "xy only":true,
37
      "pause time":1.0,
38
      "apply offset":false,
39
      "smallsize":1024,
40
      "mag only":false,
41
      "blank":false,
42
      "optimize cycle":true,
43
      "isdefault":true,
44
      "cycle":true
45
    }
46
  },
47
</pre>
48
49
You can change the name field to corresponds to the new node name. When it is imported as shown above, it shoud import into the new node and application.
50 4 Anchi Cheng
51
52 5 Anchi Cheng
[[Edit an existing application as an xml file|< Edit an existing application as an xml file]] | [[Create Leginon "Simple Application"|Create Leginon "Simple Application" >]]
53 4 Anchi Cheng
54
______