diff --git a/engine/api.py b/engine/api.py index bc96090..bb7a830 100644 --- a/engine/api.py +++ b/engine/api.py @@ -23,6 +23,8 @@ along with this program. If not, see . 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)