Commit 7d949afe authored by Guillaume Garrigos's avatar Guillaume Garrigos
Browse files

Upload TP2

parent c6bc0863
This diff is collapsed.
fixed acidity,volatile acidity,citric acid,residual sugar,chlorides,free sulfur dioxide,total sulfur dioxide,density,pH,sulphates,alcohol,quality
acidité stable,acidité volatile,acide citrique,sucre résiduel,chlorides,dioxide de soufre libre,dioxide de soufre total,densité,pH,sulfates,alcool,note
7.4,0.7,0.0,1.9,0.076,11.0,34.0,0.9978,3.51,0.56,9.4,5
7.8,0.88,0.0,2.6,0.098,25.0,67.0,0.9968,3.2,0.68,9.8,5
7.8,0.76,0.04,2.3,0.092,15.0,54.0,0.997,3.26,0.65,9.8,5
......
name: example-environment
name: environnement-tp-optim-l3
channels:
- conda-forge
dependencies:
......@@ -7,3 +7,5 @@ dependencies:
- addict
- ipympl
- ipywidgets
- pandas
- sklearn
import os, time, datetime
import multiprocessing
SESSION_LENGTH = 90 # in minutes
USED_TOKEN = False # makes sure we call the dummy worker only once
def clock():# ensures time is set to Paris wherever is run the notebook
current_time = datetime.datetime.utcnow() + datetime.timedelta(hours=1)
return current_time.strftime('%X')
def dummy_worker():
# warn the user to not run twice
#print("Session de " + str(SESSION_LENGTH) + " minutes commençant à " + clock() + ". Ne pas interrompre, ni relancer une deuxième fois.")
pause = 5
chrono = 0
nb_sleeps = int(SESSION_LENGTH/pause)
for i in range(nb_sleeps):
time.sleep(pause*60)
chrono = chrono + pause
print('Session ouverte depuis '+str(chrono)+' minutes', end="\r")
print("Session de " + str(SESSION_LENGTH) + " minutes terminée à " + clock() + ".")
print("Le serveur s'arrêtera après 10 minutes d'inactivité")
return
def start_session():
global USED_TOKEN
if USED_TOKEN:
print("Vous ne pouvez maintenir une session ouverte qu'une seule fois")
else:
USED_TOKEN = True # makes sure the dummy woker is called only once
print("Session de " + str(SESSION_LENGTH) + " minutes commençant à " + clock() + ". Ne pas interrompre, ni relancer une deuxième fois.")
if __name__ == '__main__':
multiprocessing.Process(target=dummy_worker).start()
return
\ 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