Commit 4ae22a15 authored by Guillaume Garrigos's avatar Guillaume Garrigos
Browse files

improve active session thingy

parent 8ae95e16
......@@ -29,10 +29,8 @@
"outputs": [],
"source": [
"# N'exécuter qu'une seule fois\n",
"import multiprocessing\n",
"import mybinder\n",
"if __name__ == '__main__':\n",
" multiprocessing.Process(target=mybinder.start_session).start()"
"mybinder.start_session()"
]
},
{
......
......@@ -8,7 +8,7 @@ def clock():# ensures time is set to Paris (UTC+1) wherever is run the notebook
current_time = datetime.datetime.utcnow() + datetime.timedelta(hours=1)
return current_time.strftime('%X')
def start_session():
def dummy_worker():
if USED_TOKEN.value:
print("Vous ne pouvez maintenir une session ouverte qu'une seule fois")
else:
......@@ -27,4 +27,7 @@ def start_session():
# final message
print("Session de " + str(SESSION_LENGTH) + " minutes terminée à " + clock() + ".")
print("Le serveur s'arrêtera après 10 minutes d'inactivité")
return
\ No newline at end of file
return
def start_session():
multiprocessing.Process(target=dummy_worker).start()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment