If you are using "directory format", then you have to pass the *directory* to "bokeh serve", e.g.
bokeh server --show my_app_dir/
Thanks,
Bryan
···
On Nov 10, 2016, at 7:17 AM, [email protected] wrote:
I found it! I had a feeling that it was a very simple mistake.
I was supposed to call the ``test.py`` of ``main.py`` instead. Then, I should have ran ``bokeh --show test`` from the parent folder (and name the app folder ``test``) and BOOOM. The server calls server_lifecycle.py
Thanks.
On Thursday, November 10, 2016 at 10:06:50 PM UTC+9, mauricio....@sbibits.com wrote:
Hi,I am trying to make a simple example to work using the server_lifecycle.py option, but nothing happens. Am I missing the point?
I have my files test.py and server_lifecycle.py in the same folder.
test.py is like this:
import numpy as np
from bokeh.io import curdoc
from bokeh.models import ColumnDataSourcefrom bokeh.driving import cosine
from bokeh.plotting import figure, curdoc### Define Data Sources
t = np.linspace(0, 4*np.pi, 80)
source = ColumnDataSource(dict(t=t, x = np.sin(t)))
#### PLOTS
p = figure(width=900, height=300)
#r1 = p.line([0, 4*pi], [-1, 1], color="firebrick")
r2 = p.line(source=source,x='t', y='x', color="navy", line_width=4)###
# UPDATES
###oldT = 4*np.pi
def update(step=0.5):
global oldT, oldX
#print step*oldT
newT = oldT + step
t = np.linspace(oldT, newT, 80)
x = np.sin(np.linspace(oldT, newT, 80))
oldT = newT
source.stream(dict(t=t, x=x), 1000)###LAYOUT
page = pcurdoc().add_root(page)
curdoc().add_periodic_callback(update,100)Then, the life cycle is as follows:
def on_server_loaded(server_context):
''' If present, this function is called when the server first starts. '''
print 'SERVER STARTED'
print server_context
def on_server_unloaded(server_context):
''' If present, this function is called when the server shuts down. '''
print 'Server down'
print server_contextdef on_session_created(session_context):
''' If present, this function is called when a session is created. '''
print 'Session crated'
print session_contextdef on_session_destroyed(session_context):
''' If present, this function is called when a session is closed. '''
print 'Session Closed'
print server_contextBut nothing is printed in the terminal after I run
bokeh serve --show test.py
Neither during the server starts nor when any session starts.
It fells I am missing something very simple, but I could not find any example on this.
Thank you for the feedback
Mau
This correspondence (including any attachments) is for the intended recipient(s) only. It may contain confidential or privileged information or both. No confidentiality or privilege is waived or lost by any mis-transmission. If you receive this correspondence by mistake, please contact the sender immediately, delete this correspondence (and all attachments) and destroy any hard copies. You must not use, disclose, copy, distribute or rely on any part of this correspondence (including any attachments) if you are not the intended recipient(s).本メッセージに記載および添付されている情報(以下、総称して「本情報」といいます。)は、本来の受信者による使用のみを意図しています。誤送信等により本情報を取得された場合でも、本情報に係る秘密、または法律上の秘匿特権が失われるものではありません。本電子メールを受取られた方が、本来の受信者ではない場合には、本情報及びそのコピーすべてを削除・破棄し、本電子メールが誤って届いた旨を発信者宛てにご通知下さいますようお願いします。本情報の閲覧、発信または本情報に基づくいかなる行為も明確に禁止されていることをご了承ください。
This correspondence (including any attachments) is for the intended recipient(s) only. It may contain confidential or privileged information or both. No confidentiality or privilege is waived or lost by any mis-transmission. If you receive this correspondence by mistake, please contact the sender immediately, delete this correspondence (and all attachments) and destroy any hard copies. You must not use, disclose, copy, distribute or rely on any part of this correspondence (including any attachments) if you are not the intended recipient(s).本メッセージに記載および添付されている情報(以下、総称して「本情報」といいます。)は、本来の受信者による使用のみを意図しています。誤送信等により本情報を取得された場合でも、本情報に係る秘密、または法律上の秘匿特権が失われるものではありません。本電子メールを受取られた方が、本来の受信者ではない場合には、本情報及びそのコピーすべてを削除・破棄し、本電子メールが誤って届いた旨を発信者宛てにご通知下さいますようお願いします。本情報の閲覧、発信または本情報に基づくいかなる行為も明確に禁止されていることをご了承ください。
--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/8fbc3446-dbbf-4c9f-a421-975c40aeaf01%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.