dominodatalab/python-domino

Add function(s) to publish or shutdown Apps

Closed this issue · 2 comments

Sample code for publishing new App:

import urllib2
import os

# variables
username = os.environ['DOMINO_PROJECT_OWNER']
project = os.environ['DOMINO_PROJECT_NAME']
DOMINO_USER_API_KEY = os.environ['DOMINO_USER_API_KEY']

# build request
data = '{"language": "App"}'
url = 'https://app.dominodatalab.com/u/' + username + '/' + project + '/nb/startSession'
req = urllib2.Request(url, data, {'Content-Type': 'application/json', 'X-Domino-Api-Key': DOMINO_USER_API_KEY})

# submit and print
f = urllib2.urlopen(req)
for x in f:
    print(x)
f.close()

Ideas for closing a running App:
Similar to the above, you just need to grab the runID of the currently running App. Not sure how the UI does this, but the "Unpublish" button just knows what it is.

marks commented

Nice! I merged publishing into the repo -- we still need to take on unpublishing all other versions of the app, right @macrogers ?

Yep! I imagine you could just kill any/all running instances with the “App Server” name dynamic?