Private
Public Access
1
0

removing obsolete code

This commit is contained in:
Sander Roosendaal
2021-01-16 11:27:32 +01:00
parent 31eebb06bd
commit 05a747b3c2

View File

@@ -1903,77 +1903,44 @@ def handle_otwsetpower(self,f1, boattype, boatclass, coastalbrand, weightvalue,
progressurl += "/rowers/record-progress/" progressurl += "/rowers/record-progress/"
progressurl += job_id+'/' progressurl += job_id+'/'
goservice = True
if goservice: # do something (this should return from go service)
# do something (this should return from go service) with grpc.insecure_channel(
with grpc.insecure_channel( target='localhost:50051',
target='localhost:50051', options=[('grpc.lb_policy_name', 'pick_first'),
options=[('grpc.lb_policy_name', 'pick_first'), ('grpc.enable_retries', 0), ('grpc.keepalive_timeout_ms',
('grpc.enable_retries', 0), ('grpc.keepalive_timeout_ms', 10000)]
10000)] ) as channel:
) as channel: try:
try: grpc.channel_ready_future(channel).result(timeout=10)
grpc.channel_ready_future(channel).result(timeout=10) except grpc.FutureTimeoutError:
except grpc.FutureTimeoutError: return 0
return 0
stub = calculator_pb2_grpc.PowerStub(channel) stub = calculator_pb2_grpc.PowerStub(channel)
response = stub.CalcPower(calculator_pb2.WorkoutPowerRequest( response = stub.CalcPower(calculator_pb2.WorkoutPowerRequest(
filename = csvfile, filename = csvfile,
boattype = boattype, boattype = boattype,
coastalbrand = coastalbrand, coastalbrand = coastalbrand,
crewmass = weightvalue, crewmass = weightvalue,
powermeasured = powermeasured, powermeasured = powermeasured,
progressurl = progressurl, progressurl = progressurl,
secret = secret, secret = secret,
silent = False, silent = False,
boatclass = boatclass, boatclass = boatclass,
),timeout=1200) ),timeout=1200)
result = response.result result = response.result
if result == 0: if result == 0:
# send failure email # send failure email
return 0 return 0
# do something with boat type # do something with boat type
try:
rowdata = rdata(csvfile)
except IOError:
try: try:
rowdata = rdata(csvfile) rowdata = rdata(csvfile)
except IOError: except IOError:
try: rowdata = rdata(csvfile)
rowdata = rdata(csvfile)
except IOError:
rowdata = rdata(csvfile)
else:
boatfile = {
'1x': 'static/rigging/1x.txt',
'2x': 'static/rigging/2x.txt',
'2-': 'static/rigging/2-.txt',
'4x': 'static/rigging/4x.txt',
'4-': 'static/rigging/4-.txt',
'8+': 'static/rigging/8+.txt',
}
try:
rg = rowingdata.getrigging(boatfile[boattype])
except KeyError:
rg = rowingdata.getrigging('static/rigging/1x.txt')
# determine cache file name
physics_cache = 'media/'+str(boattype)+'_'+str(int(weightvalue))
rowdata.otw_setpower(skiprows=5, mc=weightvalue, rg=rg,
powermeasured=powermeasured,
progressurl=progressurl,
secret=secret,
silent=True,
usetable=usetable,storetable=physics_cache,
)
# save data
rowdata.write_csv(f1, gzip=True)
# continuing for both
update_strokedata(workoutid, rowdata.df, debug=debug) update_strokedata(workoutid, rowdata.df, debug=debug)
totaltime = rowdata.df['TimeStamp (sec)'].max( totaltime = rowdata.df['TimeStamp (sec)'].max(