From 5f5243da8e33459489ed74aa622c1e6749b63ee0 Mon Sep 17 00:00:00 2001
From: Russell Jarvis <colouredstatic@gmail.com>
Date: Tue, 19 Nov 2019 12:38:25 +1100
Subject: [PATCH] Update dash-asynchronous.py

---
 OnlineApp/dash-asynchronous.py | 47 +++-------------------------------
 1 file changed, 4 insertions(+), 43 deletions(-)

diff --git a/OnlineApp/dash-asynchronous.py b/OnlineApp/dash-asynchronous.py
index 58f0218..5c98dc5 100644
--- a/OnlineApp/dash-asynchronous.py
+++ b/OnlineApp/dash-asynchronous.py
@@ -28,21 +28,11 @@ import base64
 
 
 def long_process(NAME):
-    if semaphore.is_locked():
-        raise Exception('Resource is locked')
-    semaphore.lock()
-    time.sleep(7)
-    semaphore.unlock()
-    #return
     print('enters long process')
-    #NAME = "S S Phatak"
     verbose = True
-
     ar = online_app_backend.call_from_front_end(NAME,verbose=verbose)
     print(ar)
-
     axes,fig = bplot.plot_author(ar,NAME)
-
     semaphore.unlock()
     return axes,fig
 
@@ -78,7 +68,7 @@ app.layout = html.Div(children=[
             }
         }
     )])
-
+'''
 
 def fig_to_uri(in_fig, close_all=True, **save_args):
     # type: (plt.Figure) -> str
@@ -95,7 +85,7 @@ def fig_to_uri(in_fig, close_all=True, **save_args):
     out_img.seek(0)  # rewind file
     encoded = base64.b64encode(out_img.read()).decode("ascii").replace("\n", "")
     return "data:image/png;base64,{}".format(encoded)
-
+'''
 app_iplot = dash.Dash()
 
 app_iplot.layout = html.Div([
@@ -116,12 +106,11 @@ app_iplot.layout = html.Div([
     Output(component_id='cur_plot', component_property='src'),
     [Input(component_id='plot_title', component_property='value'), Input(component_id = 'box_size', component_property='value')]
 )
-'''
 def update_graph(input_value, n_val):
 
     out_url = fig_to_uri(fig)
     return out_url
-
+'''
 
 external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
 
@@ -142,27 +131,6 @@ app.layout = html.Div([
 def display_status():
     return 'Running long job in background please wait {0}'.format(datetime.datetime.now()) if semaphore.is_locked() else 'Free'
 
-
-#def layout():
-#    return html.Div([
-#        html.Button('Run Process', id='button'),
-#    ])
-
-
-
-
-#app.layout = html.Div([
-#    dcc.Input(id='my-id', value='Enter Author Name here, with the name formated as you would a google scholar search', type='text'),
-#    html.Button(id='submit', type='submit', children='ok'),
-#    html.Div(id='my-div')
-#])
-
-
-#@app.callback(
-    #Output(component_id='my-div', component_property='children'),
-    #[Input(component_id='my-id', component_property='value')]
-#)
-
 @app.callback(
     Output('target', 'children'), [], [State('input', 'value')], [Event('submit', 'click')]
 )
@@ -187,15 +155,8 @@ def update_output_div(input_value):
     ])
     return plot_div
 
-#plot_url = py.plot_mpl(fig)
-#Would I then call the “plot_url” object in my dash app? For example:
-
-#app.layout =
-
-    return
 
 
 if __name__ == '__main__':
     app.run_server(host="0.0.0.0",debug=True, port=8050)
-    # app.run_server(host='127.0.0.1',port=8050)#debug=True)
-#  http://127.0.0.1:8050/
+
-- 
GitLab