File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 21
21
import traceback
22
22
23
23
import nbformat
24
+ import requests
24
25
import yaml
25
26
from arcgis .gis import GIS
26
27
from nbconvert import HTMLExporter
@@ -55,6 +56,8 @@ def _main():
55
56
if args .version :
56
57
NB_ITEM_PROPERTIES_RUNTIME_STAMP_ADVANCED ["notebookRuntimeVersion" ] = args .version
57
58
NB_ITEM_PROPERTIES_RUNTIME_STAMP_STANDARD ["notebookRuntimeVersion" ] = args .version
59
+ else :
60
+ _get_current_runtime (gis )
58
61
items_metadata_yaml = _read_items_metadata_yaml ()
59
62
if args .replace_profiles :
60
63
_replace_profiles ()
@@ -110,6 +113,16 @@ def _setup_logging(args):
110
113
log .debug ("args passed in => {}" .format (args ))
111
114
112
115
116
+ def _get_current_runtime (gis ):
117
+ ntbk_svr = gis .notebook_server [0 ]
118
+ rest = ntbk_svr ._url .replace ("/admin" , "/rest" )
119
+ rest_info = requests .get (f"{ rest } /info?f=json" , timeout = 5 , verify = False )
120
+ version = rest_info .json ()["currentRuntimeVersion" ]
121
+ NB_ITEM_PROPERTIES_RUNTIME_STAMP_ADVANCED ["notebookRuntimeVersion" ] = version
122
+ NB_ITEM_PROPERTIES_RUNTIME_STAMP_STANDARD ["notebookRuntimeVersion" ] = version
123
+ return version
124
+
125
+
113
126
def _read_items_metadata_yaml ():
114
127
"""Returns the items_metadata.yaml file as a dict"""
115
128
with open (ITEMS_METADATA_YAML_PATH ) as f :
You can’t perform that action at this time.
0 commit comments