Browse Source

Add convenience new-timestamped-session to api

tags/v0.3.0
Nils 2 months ago
parent
commit
09c2fbc5a0
1 changed files with 19 additions and 0 deletions
  1. +19
    -0
      engine/api.py

+ 19
- 0
engine/api.py View File

@@ -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)


Loading…
Cancel
Save