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 += job_id+'/'
goservice = True
if goservice:
# do something (this should return from go service)
with grpc.insecure_channel(
target='localhost:50051',
options=[('grpc.lb_policy_name', 'pick_first'),
('grpc.enable_retries', 0), ('grpc.keepalive_timeout_ms',
10000)]
) as channel:
try:
grpc.channel_ready_future(channel).result(timeout=10)
except grpc.FutureTimeoutError:
return 0
# do something (this should return from go service)
with grpc.insecure_channel(
target='localhost:50051',
options=[('grpc.lb_policy_name', 'pick_first'),
('grpc.enable_retries', 0), ('grpc.keepalive_timeout_ms',
10000)]
) as channel:
try:
grpc.channel_ready_future(channel).result(timeout=10)
except grpc.FutureTimeoutError:
return 0
stub = calculator_pb2_grpc.PowerStub(channel)
response = stub.CalcPower(calculator_pb2.WorkoutPowerRequest(
filename = csvfile,
boattype = boattype,
coastalbrand = coastalbrand,
crewmass = weightvalue,
powermeasured = powermeasured,
progressurl = progressurl,
secret = secret,
silent = False,
boatclass = boatclass,
),timeout=1200)
result = response.result
if result == 0:
# send failure email
return 0
# do something with boat type
stub = calculator_pb2_grpc.PowerStub(channel)
response = stub.CalcPower(calculator_pb2.WorkoutPowerRequest(
filename = csvfile,
boattype = boattype,
coastalbrand = coastalbrand,
crewmass = weightvalue,
powermeasured = powermeasured,
progressurl = progressurl,
secret = secret,
silent = False,
boatclass = boatclass,
),timeout=1200)
result = response.result
if result == 0:
# send failure email
return 0
# do something with boat type
try:
rowdata = rdata(csvfile)
except IOError:
try:
rowdata = rdata(csvfile)
except IOError:
try:
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
rowdata = rdata(csvfile)
update_strokedata(workoutid, rowdata.df, debug=debug)
totaltime = rowdata.df['TimeStamp (sec)'].max(