瀏覽代碼

Add convenience new-timestamped-session to api

master
Nils 3 年前
父節點
當前提交
09c2fbc5a0
  1. 19
      engine/api.py

19
engine/api.py

@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging; logger = logging.getLogger(__name__); logger.info("import")
#Standard Library
import datetime
#Our Modules
from engine.start import PATHS
@ -256,6 +258,23 @@ def getUnfilteredExecutables()->list:
#No project running
#There is no callback for _sessionsChanged because we poll that in the event loop.
def sessionNewTimestampe():
"""convenience function. Create a new session without requiring a name and add
suggested infrastructure clients"""
nsmExecutables = getNsmExecutables() #type set, cached, very fast.
connectionSaver = METADATA["preferredClients"]["data"]
dataMeta = METADATA["preferredClients"]["connections"]
startclients = []
if connectionSaver in nsmExecutables:
startclients.append(connectionSaver)
if dataMeta in nsmExecutables:
startclients.append(dataMeta)
#now = datetime.datetime.now().replace(second=0, microsecond=0).isoformat()[:-3]
now = datetime.datetime.now().replace(microsecond=0).isoformat()
name = now
sessionNew(name, startclients)
def sessionNew(newName:str, startClients:list=[]):
nsmServerControl.new(newName, startClients)

載入中…
取消
儲存