Merge branch 'develop' into feature/charts-microservice
This commit is contained in:
@@ -31,6 +31,11 @@ from zipfile import BadZipFile
|
|||||||
import zipfile
|
import zipfile
|
||||||
import os
|
import os
|
||||||
from rowers.models import strokedatafields
|
from rowers.models import strokedatafields
|
||||||
|
import grpc
|
||||||
|
import grpc.experimental
|
||||||
|
import rowers.rowing_workout_metrics_pb2 as metrics_pb2
|
||||||
|
import rowers.rowing_workout_metrics_pb2_grpc as metrics_pb2_grpc
|
||||||
|
import traceback
|
||||||
|
|
||||||
from rowingdata import (
|
from rowingdata import (
|
||||||
KinoMapParser,
|
KinoMapParser,
|
||||||
@@ -497,53 +502,85 @@ def calculate_goldmedalstandard(rower, workout, recurrance=True):
|
|||||||
|
|
||||||
|
|
||||||
def setcp(workout, background=False, recurrance=True):
|
def setcp(workout, background=False, recurrance=True):
|
||||||
filename = 'media/cpdata_{id}.parquet.gz'.format(id=workout.id)
|
try:
|
||||||
|
filename = 'media/cpdata_{id}.parquet.gz'.format(id=workout.id)
|
||||||
|
df = pd.read_parquet(filename)
|
||||||
|
|
||||||
|
if not df.empty:
|
||||||
|
# check dts
|
||||||
|
tarr = datautils.getlogarr(4000)
|
||||||
|
if df['delta'][0] in tarr:
|
||||||
|
return(df, df['delta'], df['cp'])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
strokesdf = getsmallrowdata_db(
|
strokesdf = getsmallrowdata_db(
|
||||||
['power', 'workoutid', 'time'], ids=[workout.id])
|
['power', 'workoutid', 'time'], ids=[workout.id])
|
||||||
|
|
||||||
try:
|
if strokesdf.empty:
|
||||||
if strokesdf['power'].std() == 0:
|
|
||||||
return pd.DataFrame(), pd.Series(dtype='float'), pd.Series(dtype='float')
|
|
||||||
except (KeyError, TypeError):
|
|
||||||
return pd.DataFrame(), pd.Series(dtype='float'), pd.Series(dtype='float')
|
|
||||||
|
|
||||||
if background: # pragma: no cover
|
|
||||||
_ = myqueue(queuelow, handle_setcp, strokesdf, filename, workout.id)
|
|
||||||
return pd.DataFrame({'delta': [], 'cp': []}), pd.Series(dtype='float'), pd.Series(dtype='float')
|
return pd.DataFrame({'delta': [], 'cp': []}), pd.Series(dtype='float'), pd.Series(dtype='float')
|
||||||
|
|
||||||
|
totaltime = strokesdf['time'].max()
|
||||||
|
maxt = totaltime/1000.
|
||||||
|
logarr = datautils.getlogarr(maxt)
|
||||||
|
|
||||||
|
csvfilename = workout.csvfilename
|
||||||
|
# check what the real file name is
|
||||||
|
if os.path.exists(csvfilename):
|
||||||
|
csvfile = csvfilename
|
||||||
|
elif os.path.exists(csvfilename+'.csv'): # pragma: no cover
|
||||||
|
csvfile = csvfilename+'.csv'
|
||||||
|
elif os.path.exists(csvfilename+'.gz'): # pragma: no cover
|
||||||
|
csvfile = csvfilename+'.gz'
|
||||||
|
else: # pragma: no cover
|
||||||
|
return pd.DataFrame({'delta': [], 'cp': []}), pd.Series(dtype='float'), pd.Series(dtype='float')
|
||||||
|
csvfile = os.path.abspath(csvfile)
|
||||||
|
|
||||||
if not strokesdf.empty:
|
|
||||||
totaltime = strokesdf['time'].max()
|
with grpc.insecure_channel(
|
||||||
|
target='localhost:50052',
|
||||||
|
options=[('grpc.lb_policy_name', 'pick_first'),
|
||||||
|
('grpc.enable_retries', 0), ('grpc.keepalive_timeout_ms',
|
||||||
|
10000)]
|
||||||
|
) as channel:
|
||||||
try:
|
try:
|
||||||
powermean = strokesdf['power'].mean()
|
grpc.channel_ready_future(channel).result(timeout=10)
|
||||||
except KeyError: # pragma: no cover
|
except grpc.FutureTimeoutError: # pragma: no cover
|
||||||
powermean = 0
|
dologging('metrics.log','grpc channel time out in setcp')
|
||||||
|
return pd.DataFrame({'delta': [], 'cp': []}), pd.Series(dtype='float'), pd.Series(dtype='float')
|
||||||
|
|
||||||
if powermean != 0:
|
stub = metrics_pb2_grpc.MetricsStub(channel)
|
||||||
thesecs = totaltime
|
req = metrics_pb2.CPRequest(filename = csvfile, filetype = "CSV", tarr = logarr)
|
||||||
maxt = 1.05 * thesecs
|
|
||||||
|
|
||||||
if maxt > 0:
|
try:
|
||||||
logarr = datautils.getlogarr(maxt)
|
response = stub.GetCP(req, timeout=60)
|
||||||
dfgrouped = strokesdf.groupby(['workoutid'])
|
except Exception as e:
|
||||||
delta, cpvalues, avgpower = datautils.getcp(dfgrouped, logarr)
|
dologging('metrics.log', traceback.format_exc())
|
||||||
|
return pd.DataFrame({'delta': [], 'cp': []}), pd.Series(dtype='float'), pd.Series(dtype='float')
|
||||||
|
|
||||||
df = pd.DataFrame({
|
delta = pd.Series(np.array(response.delta))
|
||||||
'delta': delta,
|
cpvalues = pd.Series(np.array(response.power))
|
||||||
'cp': cpvalues,
|
powermean = response.avgpower
|
||||||
'id': workout.id,
|
|
||||||
})
|
|
||||||
df.to_parquet(filename, engine='fastparquet',
|
|
||||||
compression='GZIP')
|
|
||||||
if recurrance:
|
|
||||||
goldmedalstandard, goldmedalduration = calculate_goldmedalstandard(
|
|
||||||
workout.user, workout)
|
|
||||||
workout.goldmedalstandard = goldmedalstandard
|
|
||||||
workout.goldmedalduration = goldmedalduration
|
|
||||||
workout.save()
|
|
||||||
return df, delta, cpvalues
|
|
||||||
|
|
||||||
return pd.DataFrame({'delta': [], 'cp': []}), pd.Series(dtype='float'), pd.Series(dtype='float')
|
|
||||||
|
|
||||||
|
df = pd.DataFrame({
|
||||||
|
'delta': delta,
|
||||||
|
'cp': cpvalues,
|
||||||
|
'id': workout.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
df.to_parquet(filename, engine='fastparquet', compression='GZIP')
|
||||||
|
|
||||||
|
if recurrance:
|
||||||
|
goldmedalstandard, goldmedalduration = calculate_goldmedalstandard(
|
||||||
|
workout.user, workout)
|
||||||
|
workout.goldmedalstandard = goldmedalstandard
|
||||||
|
workout.goldmedalduration = goldmedalduration
|
||||||
|
workout.save()
|
||||||
|
|
||||||
|
return df, delta, cpvalues
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def update_wps(r, types, mode='water', asynchron=True):
|
def update_wps(r, types, mode='water', asynchron=True):
|
||||||
@@ -679,9 +716,11 @@ def join_workouts(r, ids, title='Joined Workout',
|
|||||||
def fetchcp_new(rower, workouts):
|
def fetchcp_new(rower, workouts):
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
|
|
||||||
for workout in workouts:
|
for workout in workouts:
|
||||||
cpfile = 'media/cpdata_{id}.parquet.gz'.format(id=workout.id)
|
cpfile = 'media/cpdata_{id}.parquet.gz'.format(id=workout.id)
|
||||||
try:
|
try:
|
||||||
|
df, delta, cpvalues = setcp(workout)
|
||||||
df = pd.read_parquet(cpfile)
|
df = pd.read_parquet(cpfile)
|
||||||
df['workout'] = str(workout)
|
df['workout'] = str(workout)
|
||||||
df['url'] = workout.url()
|
df['url'] = workout.url()
|
||||||
@@ -698,12 +737,15 @@ def fetchcp_new(rower, workouts):
|
|||||||
if len(data) > 1:
|
if len(data) > 1:
|
||||||
df = pd.concat(data, axis=0)
|
df = pd.concat(data, axis=0)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
df = df[df['cp'] == df.groupby(['delta'])['cp'].transform('max')]
|
df = df[df['cp'] == df.groupby(['delta'])['cp'].transform('max')]
|
||||||
except KeyError: # pragma: no cover
|
except KeyError: # pragma: no cover
|
||||||
return pd.Series(dtype='float'), pd.Series(dtype='float'), 0, pd.Series(dtype='float'), pd.Series(dtype='float')
|
return pd.Series(dtype='float'), pd.Series(dtype='float'), 0, pd.Series(dtype='float'), pd.Series(dtype='float')
|
||||||
|
|
||||||
df = df.sort_values(['delta']).reset_index()
|
df = df.sort_values(['delta']).reset_index()
|
||||||
|
df = df[df['cp']>20]
|
||||||
|
|
||||||
|
|
||||||
return df['delta'], df['cp'], 0, df['workout'], df['url']
|
return df['delta'], df['cp'], 0, df['workout'], df['url']
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.interpolate import griddata
|
from scipy.interpolate import griddata
|
||||||
@@ -124,18 +123,18 @@ def cpfit(powerdf, fraclimit=0.0001, nmax=1000):
|
|||||||
|
|
||||||
|
|
||||||
def getlogarr(maxt):
|
def getlogarr(maxt):
|
||||||
maxlog10 = np.log10(maxt-5)
|
dtmin = 10
|
||||||
|
maxlog10 = np.log10(maxt)
|
||||||
# print(maxlog10,round(maxlog10))
|
# print(maxlog10,round(maxlog10))
|
||||||
aantal = 10*round(maxlog10)
|
aantal = 40
|
||||||
logarr = np.arange(aantal+1)/10.
|
logarr = np.arange(aantal+1)/10.
|
||||||
|
vs = 10.**logarr
|
||||||
|
|
||||||
|
|
||||||
res = []
|
res = []
|
||||||
for la in logarr:
|
for v in vs:
|
||||||
try:
|
if v > dtmin and v<maxt:
|
||||||
v = 5+int(10.**(la))
|
res.append(int(v))
|
||||||
except ValueError: # pragma: no cover
|
|
||||||
v = 0
|
|
||||||
res.append(v)
|
|
||||||
|
|
||||||
logarr = pd.Series(res, dtype='float')
|
logarr = pd.Series(res, dtype='float')
|
||||||
logarr.drop_duplicates(keep='first', inplace=True)
|
logarr.drop_duplicates(keep='first', inplace=True)
|
||||||
|
|||||||
@@ -1823,15 +1823,18 @@ class InstantPlan(models.Model):
|
|||||||
authorizationstring = 'Bearer '+settings.WORKOUTS_FIT_TOKEN
|
authorizationstring = 'Bearer '+settings.WORKOUTS_FIT_TOKEN
|
||||||
url = settings.WORKOUTS_FIT_URL+"/trainingplan/"
|
url = settings.WORKOUTS_FIT_URL+"/trainingplan/"
|
||||||
headers = {'Authorization': authorizationstring}
|
headers = {'Authorization': authorizationstring}
|
||||||
response = requests.post(url=url, headers=headers, data=yamltext)
|
try:
|
||||||
if response.status_code == 200:
|
response = requests.post(url=url, headers=headers, data=yamltext)
|
||||||
data = response.json()
|
if response.status_code == 200:
|
||||||
self.yaml.name = data['filename']
|
data = response.json()
|
||||||
self.uuid = data['ID']
|
self.yaml.name = data['filename']
|
||||||
self.name = data['name']
|
self.uuid = data['ID']
|
||||||
self.description = data['description']
|
self.name = data['name']
|
||||||
self.duration = data['duration']
|
self.description = data['description']
|
||||||
self.yaml = None
|
self.duration = data['duration']
|
||||||
|
self.yaml = None
|
||||||
|
except:
|
||||||
|
pass
|
||||||
super(InstantPlan, self).save(*args, **kwargs)
|
super(InstantPlan, self).save(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,185 +1,31 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
# source: otw-power-calculator.proto
|
# source: otw-power-calculator.proto
|
||||||
|
# Protobuf Python Version: 4.25.1
|
||||||
from google.protobuf import symbol_database as _symbol_database
|
"""Generated protocol buffer code."""
|
||||||
from google.protobuf import reflection as _reflection
|
|
||||||
from google.protobuf import message as _message
|
|
||||||
from google.protobuf import descriptor as _descriptor
|
from google.protobuf import descriptor as _descriptor
|
||||||
import sys
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||||
_b = sys.version_info[0] < 3 and (
|
from google.protobuf import symbol_database as _symbol_database
|
||||||
lambda x: x) or (lambda x: x.encode('latin1'))
|
from google.protobuf.internal import builder as _builder
|
||||||
# @@protoc_insertion_point(imports)
|
# @@protoc_insertion_point(imports)
|
||||||
|
|
||||||
_sym_db = _symbol_database.Default()
|
_sym_db = _symbol_database.Default()
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
|
||||||
name='otw-power-calculator.proto',
|
|
||||||
package='otw_power_calculator',
|
|
||||||
syntax='proto3',
|
|
||||||
serialized_options=None,
|
|
||||||
serialized_pb=_b('\n\x1aotw-power-calculator.proto\x12\x14otw_power_calculator\"\xc0\x01\n\x13WorkoutPowerRequest\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x10\n\x08\x62oattype\x18\x02 \x01(\t\x12\x10\n\x08\x63rewmass\x18\x03 \x01(\x01\x12\x15\n\rpowermeasured\x18\x04 \x01(\x08\x12\x13\n\x0bprogressurl\x18\x05 \x01(\t\x12\x0e\n\x06secret\x18\x06 \x01(\t\x12\x0e\n\x06silent\x18\x07 \x01(\x08\x12\x11\n\tboatclass\x18\x08 \x01(\t\x12\x14\n\x0c\x63oastalbrand\x18\t \x01(\t\"#\n\x11\x43\x61lculationResult\x12\x0e\n\x06result\x18\x01 \x01(\x05\x32j\n\x05Power\x12\x61\n\tCalcPower\x12).otw_power_calculator.WorkoutPowerRequest\x1a\'.otw_power_calculator.CalculationResult\"\x00\x62\x06proto3')
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_WORKOUTPOWERREQUEST = _descriptor.Descriptor(
|
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1aotw-power-calculator.proto\x12\x14otw_power_calculator\"\xc0\x01\n\x13WorkoutPowerRequest\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x10\n\x08\x62oattype\x18\x02 \x01(\t\x12\x10\n\x08\x63rewmass\x18\x03 \x01(\x01\x12\x15\n\rpowermeasured\x18\x04 \x01(\x08\x12\x13\n\x0bprogressurl\x18\x05 \x01(\t\x12\x0e\n\x06secret\x18\x06 \x01(\t\x12\x0e\n\x06silent\x18\x07 \x01(\x08\x12\x11\n\tboatclass\x18\x08 \x01(\t\x12\x14\n\x0c\x63oastalbrand\x18\t \x01(\t\"#\n\x11\x43\x61lculationResult\x12\x0e\n\x06result\x18\x01 \x01(\x05\x32j\n\x05Power\x12\x61\n\tCalcPower\x12).otw_power_calculator.WorkoutPowerRequest\x1a\'.otw_power_calculator.CalculationResult\"\x00\x42\x18Z\x16./otw-power-calculatorb\x06proto3')
|
||||||
name='WorkoutPowerRequest',
|
|
||||||
full_name='otw_power_calculator.WorkoutPowerRequest',
|
|
||||||
filename=None,
|
|
||||||
file=DESCRIPTOR,
|
|
||||||
containing_type=None,
|
|
||||||
fields=[
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='filename', full_name='otw_power_calculator.WorkoutPowerRequest.filename', index=0,
|
|
||||||
number=1, type=9, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='boattype', full_name='otw_power_calculator.WorkoutPowerRequest.boattype', index=1,
|
|
||||||
number=2, type=9, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='crewmass', full_name='otw_power_calculator.WorkoutPowerRequest.crewmass', index=2,
|
|
||||||
number=3, type=1, cpp_type=5, label=1,
|
|
||||||
has_default_value=False, default_value=float(0),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='powermeasured', full_name='otw_power_calculator.WorkoutPowerRequest.powermeasured', index=3,
|
|
||||||
number=4, type=8, cpp_type=7, label=1,
|
|
||||||
has_default_value=False, default_value=False,
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='progressurl', full_name='otw_power_calculator.WorkoutPowerRequest.progressurl', index=4,
|
|
||||||
number=5, type=9, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='secret', full_name='otw_power_calculator.WorkoutPowerRequest.secret', index=5,
|
|
||||||
number=6, type=9, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='silent', full_name='otw_power_calculator.WorkoutPowerRequest.silent', index=6,
|
|
||||||
number=7, type=8, cpp_type=7, label=1,
|
|
||||||
has_default_value=False, default_value=False,
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='boatclass', full_name='otw_power_calculator.WorkoutPowerRequest.boatclass', index=7,
|
|
||||||
number=8, type=9, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='coastalbrand', full_name='otw_power_calculator.WorkoutPowerRequest.coastalbrand', index=8,
|
|
||||||
number=9, type=9, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
],
|
|
||||||
extensions=[
|
|
||||||
],
|
|
||||||
nested_types=[],
|
|
||||||
enum_types=[
|
|
||||||
],
|
|
||||||
serialized_options=None,
|
|
||||||
is_extendable=False,
|
|
||||||
syntax='proto3',
|
|
||||||
extension_ranges=[],
|
|
||||||
oneofs=[
|
|
||||||
],
|
|
||||||
serialized_start=53,
|
|
||||||
serialized_end=245,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_CALCULATIONRESULT = _descriptor.Descriptor(
|
|
||||||
name='CalculationResult',
|
|
||||||
full_name='otw_power_calculator.CalculationResult',
|
|
||||||
filename=None,
|
|
||||||
file=DESCRIPTOR,
|
|
||||||
containing_type=None,
|
|
||||||
fields=[
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='result', full_name='otw_power_calculator.CalculationResult.result', index=0,
|
|
||||||
number=1, type=5, cpp_type=1, label=1,
|
|
||||||
has_default_value=False, default_value=0,
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
],
|
|
||||||
extensions=[
|
|
||||||
],
|
|
||||||
nested_types=[],
|
|
||||||
enum_types=[
|
|
||||||
],
|
|
||||||
serialized_options=None,
|
|
||||||
is_extendable=False,
|
|
||||||
syntax='proto3',
|
|
||||||
extension_ranges=[],
|
|
||||||
oneofs=[
|
|
||||||
],
|
|
||||||
serialized_start=247,
|
|
||||||
serialized_end=282,
|
|
||||||
)
|
|
||||||
|
|
||||||
DESCRIPTOR.message_types_by_name['WorkoutPowerRequest'] = _WORKOUTPOWERREQUEST
|
|
||||||
DESCRIPTOR.message_types_by_name['CalculationResult'] = _CALCULATIONRESULT
|
|
||||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
|
||||||
|
|
||||||
WorkoutPowerRequest = _reflection.GeneratedProtocolMessageType('WorkoutPowerRequest', (_message.Message,), {
|
|
||||||
'DESCRIPTOR': _WORKOUTPOWERREQUEST,
|
|
||||||
'__module__': 'otw_power_calculator_pb2'
|
|
||||||
# @@protoc_insertion_point(class_scope:otw_power_calculator.WorkoutPowerRequest)
|
|
||||||
})
|
|
||||||
_sym_db.RegisterMessage(WorkoutPowerRequest)
|
|
||||||
|
|
||||||
CalculationResult = _reflection.GeneratedProtocolMessageType('CalculationResult', (_message.Message,), {
|
|
||||||
'DESCRIPTOR': _CALCULATIONRESULT,
|
|
||||||
'__module__': 'otw_power_calculator_pb2'
|
|
||||||
# @@protoc_insertion_point(class_scope:otw_power_calculator.CalculationResult)
|
|
||||||
})
|
|
||||||
_sym_db.RegisterMessage(CalculationResult)
|
|
||||||
|
|
||||||
|
|
||||||
_POWER = _descriptor.ServiceDescriptor(
|
|
||||||
name='Power',
|
|
||||||
full_name='otw_power_calculator.Power',
|
|
||||||
file=DESCRIPTOR,
|
|
||||||
index=0,
|
|
||||||
serialized_options=None,
|
|
||||||
serialized_start=284,
|
|
||||||
serialized_end=390,
|
|
||||||
methods=[
|
|
||||||
_descriptor.MethodDescriptor(
|
|
||||||
name='CalcPower',
|
|
||||||
full_name='otw_power_calculator.Power.CalcPower',
|
|
||||||
index=0,
|
|
||||||
containing_service=None,
|
|
||||||
input_type=_WORKOUTPOWERREQUEST,
|
|
||||||
output_type=_CALCULATIONRESULT,
|
|
||||||
serialized_options=None,
|
|
||||||
),
|
|
||||||
])
|
|
||||||
_sym_db.RegisterServiceDescriptor(_POWER)
|
|
||||||
|
|
||||||
DESCRIPTOR.services_by_name['Power'] = _POWER
|
|
||||||
|
|
||||||
|
_globals = globals()
|
||||||
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||||
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'otw_power_calculator_pb2', _globals)
|
||||||
|
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||||
|
_globals['DESCRIPTOR']._options = None
|
||||||
|
_globals['DESCRIPTOR']._serialized_options = b'Z\026./otw-power-calculator'
|
||||||
|
_globals['_WORKOUTPOWERREQUEST']._serialized_start=53
|
||||||
|
_globals['_WORKOUTPOWERREQUEST']._serialized_end=245
|
||||||
|
_globals['_CALCULATIONRESULT']._serialized_start=247
|
||||||
|
_globals['_CALCULATIONRESULT']._serialized_end=282
|
||||||
|
_globals['_POWER']._serialized_start=284
|
||||||
|
_globals['_POWER']._serialized_end=390
|
||||||
# @@protoc_insertion_point(module_scope)
|
# @@protoc_insertion_point(module_scope)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||||
|
"""Client and server classes corresponding to protobuf-defined services."""
|
||||||
import grpc
|
import grpc
|
||||||
|
|
||||||
import rowers.otw_power_calculator_pb2 as otw__power__calculator__pb2
|
import rowers.otw_power_calculator_pb2 as otw__power__calculator__pb2
|
||||||
@@ -12,36 +13,57 @@ class PowerStub(object):
|
|||||||
"""Constructor.
|
"""Constructor.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
channel: A grpc.Channel.
|
channel: A grpc.Channel.
|
||||||
"""
|
"""
|
||||||
self.CalcPower = channel.unary_unary(
|
self.CalcPower = channel.unary_unary(
|
||||||
'/otw_power_calculator.Power/CalcPower',
|
'/otw_power_calculator.Power/CalcPower',
|
||||||
request_serializer=otw__power__calculator__pb2.WorkoutPowerRequest.SerializeToString,
|
request_serializer=otw__power__calculator__pb2.WorkoutPowerRequest.SerializeToString,
|
||||||
response_deserializer=otw__power__calculator__pb2.CalculationResult.FromString,
|
response_deserializer=otw__power__calculator__pb2.CalculationResult.FromString,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class PowerServicer(object):
|
class PowerServicer(object):
|
||||||
"""Power service definition
|
"""Power service definition
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def CalcPower(self, request, context): # pragma: no cover
|
def CalcPower(self, request, context):
|
||||||
# missing associated documentation comment in .proto file
|
"""Missing associated documentation comment in .proto file."""
|
||||||
pass
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED) # pragma: no cover
|
context.set_details('Method not implemented!')
|
||||||
context.set_details('Method not implemented!') # pragma: no cover
|
raise NotImplementedError('Method not implemented!')
|
||||||
raise NotImplementedError(
|
|
||||||
'Method not implemented!') # pragma: no cover
|
|
||||||
|
|
||||||
|
|
||||||
def add_PowerServicer_to_server(servicer, server): # pragma: no cover
|
def add_PowerServicer_to_server(servicer, server):
|
||||||
rpc_method_handlers = {
|
rpc_method_handlers = {
|
||||||
'CalcPower': grpc.unary_unary_rpc_method_handler(
|
'CalcPower': grpc.unary_unary_rpc_method_handler(
|
||||||
servicer.CalcPower,
|
servicer.CalcPower,
|
||||||
request_deserializer=otw__power__calculator__pb2.WorkoutPowerRequest.FromString,
|
request_deserializer=otw__power__calculator__pb2.WorkoutPowerRequest.FromString,
|
||||||
response_serializer=otw__power__calculator__pb2.CalculationResult.SerializeToString,
|
response_serializer=otw__power__calculator__pb2.CalculationResult.SerializeToString,
|
||||||
),
|
),
|
||||||
} # pragma: no cover
|
}
|
||||||
generic_handler = grpc.method_handlers_generic_handler(
|
generic_handler = grpc.method_handlers_generic_handler(
|
||||||
'otw_power_calculator.Power', rpc_method_handlers)
|
'otw_power_calculator.Power', rpc_method_handlers)
|
||||||
server.add_generic_rpc_handlers((generic_handler,))
|
server.add_generic_rpc_handlers((generic_handler,))
|
||||||
|
|
||||||
|
|
||||||
|
# This class is part of an EXPERIMENTAL API.
|
||||||
|
class Power(object):
|
||||||
|
"""Power service definition
|
||||||
|
"""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def CalcPower(request,
|
||||||
|
target,
|
||||||
|
options=(),
|
||||||
|
channel_credentials=None,
|
||||||
|
call_credentials=None,
|
||||||
|
insecure=False,
|
||||||
|
compression=None,
|
||||||
|
wait_for_ready=None,
|
||||||
|
timeout=None,
|
||||||
|
metadata=None):
|
||||||
|
return grpc.experimental.unary_unary(request, target, '/otw_power_calculator.Power/CalcPower',
|
||||||
|
otw__power__calculator__pb2.WorkoutPowerRequest.SerializeToString,
|
||||||
|
otw__power__calculator__pb2.CalculationResult.FromString,
|
||||||
|
options, channel_credentials,
|
||||||
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||||
|
|||||||
@@ -1,210 +1,35 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
# source: rowing-workout-metrics.proto
|
# source: rowing-workout-metrics.proto
|
||||||
|
# Protobuf Python Version: 4.25.1
|
||||||
from google.protobuf import symbol_database as _symbol_database
|
"""Generated protocol buffer code."""
|
||||||
from google.protobuf import reflection as _reflection
|
|
||||||
from google.protobuf import message as _message
|
|
||||||
from google.protobuf import descriptor as _descriptor
|
from google.protobuf import descriptor as _descriptor
|
||||||
import sys
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||||
_b = sys.version_info[0] < 3 and (
|
from google.protobuf import symbol_database as _symbol_database
|
||||||
lambda x: x) or (lambda x: x.encode('latin1'))
|
from google.protobuf.internal import builder as _builder
|
||||||
# @@protoc_insertion_point(imports)
|
# @@protoc_insertion_point(imports)
|
||||||
|
|
||||||
_sym_db = _symbol_database.Default()
|
_sym_db = _symbol_database.Default()
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
|
||||||
name='rowing-workout-metrics.proto',
|
|
||||||
package='rowing_workout_metrics',
|
|
||||||
syntax='proto3',
|
|
||||||
serialized_options=None,
|
|
||||||
serialized_pb=_b('\n\x1crowing-workout-metrics.proto\x12\x16'
|
|
||||||
'rowing_workout_metrics\"p\n\x15WorkoutMetricsRequest'
|
|
||||||
'\x12\x10\n\x08\x66ilename'
|
|
||||||
'\x18\x01 \x01(\t\x12\x0b\n\x03sex'
|
|
||||||
'\x18\x02 \x01(\t\x12\x0b\n\x03\x66tp\x18\x03 \x01'
|
|
||||||
'(\x01\x12\r\n\x05hrftp\x18\x04 \x01(\x01\x12\r\n\x05hrmax'
|
|
||||||
'\x18\x05 \x01(\x01\x12\r\n\x05hrmin\x18\x06 \x01(\x01\"p\n\x16WorkoutMetricsResponse'
|
|
||||||
'\x12\x0b\n\x03tss\x18\x01 \x01(\x01\x12\r\n\x05normp\x18\x02 \x01(\x01\x12\r\n\x05trimp'
|
|
||||||
'\x18\x03 \x01(\x01\x12\r\n\x05hrtss\x18\x04 \x01(\x01\x12\r\n\x05normv'
|
|
||||||
'\x18\x05 \x01(\x01\x12\r\n\x05normw\x18\x06 \x01(\x01\x32w\n\x07Metrics'
|
|
||||||
'\x12l\n\x0b\x43\x61lcMetrics\x12-.rowing_workout_metrics.WorkoutMetricsRequest'
|
|
||||||
'\x1a..rowing_workout_metrics.WorkoutMetricsResponseb\x06proto3')
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_WORKOUTMETRICSREQUEST = _descriptor.Descriptor(
|
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1crowing-workout-metrics.proto\x12\x16rowing_workout_metrics\"p\n\x15WorkoutMetricsRequest\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x0b\n\x03sex\x18\x02 \x01(\t\x12\x0b\n\x03\x66tp\x18\x03 \x01(\x01\x12\r\n\x05hrftp\x18\x04 \x01(\x01\x12\r\n\x05hrmax\x18\x05 \x01(\x01\x12\r\n\x05hrmin\x18\x06 \x01(\x01\"p\n\x16WorkoutMetricsResponse\x12\x0b\n\x03tss\x18\x01 \x01(\x01\x12\r\n\x05normp\x18\x02 \x01(\x01\x12\r\n\x05trimp\x18\x03 \x01(\x01\x12\r\n\x05hrtss\x18\x04 \x01(\x01\x12\r\n\x05normv\x18\x05 \x01(\x01\x12\r\n\x05normw\x18\x06 \x01(\x01\"=\n\tCPRequest\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x10\n\x08\x66iletype\x18\x02 \x01(\t\x12\x0c\n\x04tarr\x18\x03 \x03(\x01\"<\n\nCPResponse\x12\r\n\x05\x64\x65lta\x18\x01 \x03(\x01\x12\r\n\x05power\x18\x02 \x03(\x01\x12\x10\n\x08\x61vgpower\x18\x03 \x01(\x01\x32\xc7\x01\n\x07Metrics\x12l\n\x0b\x43\x61lcMetrics\x12-.rowing_workout_metrics.WorkoutMetricsRequest\x1a..rowing_workout_metrics.WorkoutMetricsResponse\x12N\n\x05GetCP\x12!.rowing_workout_metrics.CPRequest\x1a\".rowing_workout_metrics.CPResponseB\x1aZ\x18./rowing-workout-metricsb\x06proto3')
|
||||||
name='WorkoutMetricsRequest',
|
|
||||||
full_name='rowing_workout_metrics.WorkoutMetricsRequest',
|
|
||||||
filename=None,
|
|
||||||
file=DESCRIPTOR,
|
|
||||||
containing_type=None,
|
|
||||||
fields=[
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='filename', full_name='rowing_workout_metrics.WorkoutMetricsRequest.filename', index=0,
|
|
||||||
number=1, type=9, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='sex', full_name='rowing_workout_metrics.WorkoutMetricsRequest.sex', index=1,
|
|
||||||
number=2, type=9, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='ftp', full_name='rowing_workout_metrics.WorkoutMetricsRequest.ftp', index=2,
|
|
||||||
number=3, type=1, cpp_type=5, label=1,
|
|
||||||
has_default_value=False, default_value=float(0),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='hrftp', full_name='rowing_workout_metrics.WorkoutMetricsRequest.hrftp', index=3,
|
|
||||||
number=4, type=1, cpp_type=5, label=1,
|
|
||||||
has_default_value=False, default_value=float(0),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='hrmax', full_name='rowing_workout_metrics.WorkoutMetricsRequest.hrmax', index=4,
|
|
||||||
number=5, type=1, cpp_type=5, label=1,
|
|
||||||
has_default_value=False, default_value=float(0),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='hrmin', full_name='rowing_workout_metrics.WorkoutMetricsRequest.hrmin', index=5,
|
|
||||||
number=6, type=1, cpp_type=5, label=1,
|
|
||||||
has_default_value=False, default_value=float(0),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
],
|
|
||||||
extensions=[
|
|
||||||
],
|
|
||||||
nested_types=[],
|
|
||||||
enum_types=[
|
|
||||||
],
|
|
||||||
serialized_options=None,
|
|
||||||
is_extendable=False,
|
|
||||||
syntax='proto3',
|
|
||||||
extension_ranges=[],
|
|
||||||
oneofs=[
|
|
||||||
],
|
|
||||||
serialized_start=56,
|
|
||||||
serialized_end=168,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_WORKOUTMETRICSRESPONSE = _descriptor.Descriptor(
|
|
||||||
name='WorkoutMetricsResponse',
|
|
||||||
full_name='rowing_workout_metrics.WorkoutMetricsResponse',
|
|
||||||
filename=None,
|
|
||||||
file=DESCRIPTOR,
|
|
||||||
containing_type=None,
|
|
||||||
fields=[
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='tss', full_name='rowing_workout_metrics.WorkoutMetricsResponse.tss', index=0,
|
|
||||||
number=1, type=1, cpp_type=5, label=1,
|
|
||||||
has_default_value=False, default_value=float(0),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='normp', full_name='rowing_workout_metrics.WorkoutMetricsResponse.normp', index=1,
|
|
||||||
number=2, type=1, cpp_type=5, label=1,
|
|
||||||
has_default_value=False, default_value=float(0),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='trimp', full_name='rowing_workout_metrics.WorkoutMetricsResponse.trimp', index=2,
|
|
||||||
number=3, type=1, cpp_type=5, label=1,
|
|
||||||
has_default_value=False, default_value=float(0),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='hrtss', full_name='rowing_workout_metrics.WorkoutMetricsResponse.hrtss', index=3,
|
|
||||||
number=4, type=1, cpp_type=5, label=1,
|
|
||||||
has_default_value=False, default_value=float(0),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='normv', full_name='rowing_workout_metrics.WorkoutMetricsResponse.normv', index=4,
|
|
||||||
number=5, type=1, cpp_type=5, label=1,
|
|
||||||
has_default_value=False, default_value=float(0),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='normw', full_name='rowing_workout_metrics.WorkoutMetricsResponse.normw', index=5,
|
|
||||||
number=6, type=1, cpp_type=5, label=1,
|
|
||||||
has_default_value=False, default_value=float(0),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
serialized_options=None, file=DESCRIPTOR),
|
|
||||||
],
|
|
||||||
extensions=[
|
|
||||||
],
|
|
||||||
nested_types=[],
|
|
||||||
enum_types=[
|
|
||||||
],
|
|
||||||
serialized_options=None,
|
|
||||||
is_extendable=False,
|
|
||||||
syntax='proto3',
|
|
||||||
extension_ranges=[],
|
|
||||||
oneofs=[
|
|
||||||
],
|
|
||||||
serialized_start=170,
|
|
||||||
serialized_end=282,
|
|
||||||
)
|
|
||||||
|
|
||||||
DESCRIPTOR.message_types_by_name['WorkoutMetricsRequest'] = _WORKOUTMETRICSREQUEST
|
|
||||||
DESCRIPTOR.message_types_by_name['WorkoutMetricsResponse'] = _WORKOUTMETRICSRESPONSE
|
|
||||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
|
||||||
|
|
||||||
WorkoutMetricsRequest = _reflection.GeneratedProtocolMessageType('WorkoutMetricsRequest', (_message.Message,), {
|
|
||||||
'DESCRIPTOR': _WORKOUTMETRICSREQUEST,
|
|
||||||
'__module__': 'rowing_workout_metrics_pb2'
|
|
||||||
# @@protoc_insertion_point(class_scope:rowing_workout_metrics.WorkoutMetricsRequest)
|
|
||||||
})
|
|
||||||
_sym_db.RegisterMessage(WorkoutMetricsRequest)
|
|
||||||
|
|
||||||
WorkoutMetricsResponse = _reflection.GeneratedProtocolMessageType('WorkoutMetricsResponse', (_message.Message,), {
|
|
||||||
'DESCRIPTOR': _WORKOUTMETRICSRESPONSE,
|
|
||||||
'__module__': 'rowing_workout_metrics_pb2'
|
|
||||||
# @@protoc_insertion_point(class_scope:rowing_workout_metrics.WorkoutMetricsResponse)
|
|
||||||
})
|
|
||||||
_sym_db.RegisterMessage(WorkoutMetricsResponse)
|
|
||||||
|
|
||||||
|
|
||||||
_METRICS = _descriptor.ServiceDescriptor(
|
|
||||||
name='Metrics',
|
|
||||||
full_name='rowing_workout_metrics.Metrics',
|
|
||||||
file=DESCRIPTOR,
|
|
||||||
index=0,
|
|
||||||
serialized_options=None,
|
|
||||||
serialized_start=284,
|
|
||||||
serialized_end=403,
|
|
||||||
methods=[
|
|
||||||
_descriptor.MethodDescriptor(
|
|
||||||
name='CalcMetrics',
|
|
||||||
full_name='rowing_workout_metrics.Metrics.CalcMetrics',
|
|
||||||
index=0,
|
|
||||||
containing_service=None,
|
|
||||||
input_type=_WORKOUTMETRICSREQUEST,
|
|
||||||
output_type=_WORKOUTMETRICSRESPONSE,
|
|
||||||
serialized_options=None,
|
|
||||||
),
|
|
||||||
])
|
|
||||||
_sym_db.RegisterServiceDescriptor(_METRICS)
|
|
||||||
|
|
||||||
DESCRIPTOR.services_by_name['Metrics'] = _METRICS
|
|
||||||
|
|
||||||
|
_globals = globals()
|
||||||
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||||
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'rowing_workout_metrics_pb2', _globals)
|
||||||
|
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||||
|
_globals['DESCRIPTOR']._options = None
|
||||||
|
_globals['DESCRIPTOR']._serialized_options = b'Z\030./rowing-workout-metrics'
|
||||||
|
_globals['_WORKOUTMETRICSREQUEST']._serialized_start=56
|
||||||
|
_globals['_WORKOUTMETRICSREQUEST']._serialized_end=168
|
||||||
|
_globals['_WORKOUTMETRICSRESPONSE']._serialized_start=170
|
||||||
|
_globals['_WORKOUTMETRICSRESPONSE']._serialized_end=282
|
||||||
|
_globals['_CPREQUEST']._serialized_start=284
|
||||||
|
_globals['_CPREQUEST']._serialized_end=345
|
||||||
|
_globals['_CPRESPONSE']._serialized_start=347
|
||||||
|
_globals['_CPRESPONSE']._serialized_end=407
|
||||||
|
_globals['_METRICS']._serialized_start=410
|
||||||
|
_globals['_METRICS']._serialized_end=609
|
||||||
# @@protoc_insertion_point(module_scope)
|
# @@protoc_insertion_point(module_scope)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||||
|
"""Client and server classes corresponding to protobuf-defined services."""
|
||||||
import grpc
|
import grpc
|
||||||
|
|
||||||
import rowers.rowing_workout_metrics_pb2 as rowing__workout__metrics__pb2
|
import rowers.rowing_workout_metrics_pb2 as rowing__workout__metrics__pb2
|
||||||
@@ -12,13 +13,18 @@ class MetricsStub(object):
|
|||||||
"""Constructor.
|
"""Constructor.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
channel: A grpc.Channel.
|
channel: A grpc.Channel.
|
||||||
"""
|
"""
|
||||||
self.CalcMetrics = channel.unary_unary(
|
self.CalcMetrics = channel.unary_unary(
|
||||||
'/rowing_workout_metrics.Metrics/CalcMetrics',
|
'/rowing_workout_metrics.Metrics/CalcMetrics',
|
||||||
request_serializer=rowing__workout__metrics__pb2.WorkoutMetricsRequest.SerializeToString,
|
request_serializer=rowing__workout__metrics__pb2.WorkoutMetricsRequest.SerializeToString,
|
||||||
response_deserializer=rowing__workout__metrics__pb2.WorkoutMetricsResponse.FromString,
|
response_deserializer=rowing__workout__metrics__pb2.WorkoutMetricsResponse.FromString,
|
||||||
)
|
)
|
||||||
|
self.GetCP = channel.unary_unary(
|
||||||
|
'/rowing_workout_metrics.Metrics/GetCP',
|
||||||
|
request_serializer=rowing__workout__metrics__pb2.CPRequest.SerializeToString,
|
||||||
|
response_deserializer=rowing__workout__metrics__pb2.CPResponse.FromString,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class MetricsServicer(object):
|
class MetricsServicer(object):
|
||||||
@@ -26,22 +32,71 @@ class MetricsServicer(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def CalcMetrics(self, request, context):
|
def CalcMetrics(self, request, context):
|
||||||
# missing associated documentation comment in .proto file
|
"""Missing associated documentation comment in .proto file."""
|
||||||
pass
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED) # pragma: no cover
|
context.set_details('Method not implemented!')
|
||||||
context.set_details('Method not implemented!') # pragma: no cover
|
raise NotImplementedError('Method not implemented!')
|
||||||
raise NotImplementedError(
|
|
||||||
'Method not implemented!') # pragma: no cover
|
def GetCP(self, request, context):
|
||||||
|
"""Missing associated documentation comment in .proto file."""
|
||||||
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||||
|
context.set_details('Method not implemented!')
|
||||||
|
raise NotImplementedError('Method not implemented!')
|
||||||
|
|
||||||
|
|
||||||
def add_MetricsServicer_to_server(servicer, server): # pragma: no cover
|
def add_MetricsServicer_to_server(servicer, server):
|
||||||
rpc_method_handlers = {
|
rpc_method_handlers = {
|
||||||
'CalcMetrics': grpc.unary_unary_rpc_method_handler(
|
'CalcMetrics': grpc.unary_unary_rpc_method_handler(
|
||||||
servicer.CalcMetrics,
|
servicer.CalcMetrics,
|
||||||
request_deserializer=rowing__workout__metrics__pb2.WorkoutMetricsRequest.FromString,
|
request_deserializer=rowing__workout__metrics__pb2.WorkoutMetricsRequest.FromString,
|
||||||
response_serializer=rowing__workout__metrics__pb2.WorkoutMetricsResponse.SerializeToString,
|
response_serializer=rowing__workout__metrics__pb2.WorkoutMetricsResponse.SerializeToString,
|
||||||
),
|
),
|
||||||
|
'GetCP': grpc.unary_unary_rpc_method_handler(
|
||||||
|
servicer.GetCP,
|
||||||
|
request_deserializer=rowing__workout__metrics__pb2.CPRequest.FromString,
|
||||||
|
response_serializer=rowing__workout__metrics__pb2.CPResponse.SerializeToString,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
generic_handler = grpc.method_handlers_generic_handler(
|
generic_handler = grpc.method_handlers_generic_handler(
|
||||||
'rowing_workout_metrics.Metrics', rpc_method_handlers)
|
'rowing_workout_metrics.Metrics', rpc_method_handlers)
|
||||||
server.add_generic_rpc_handlers((generic_handler,))
|
server.add_generic_rpc_handlers((generic_handler,))
|
||||||
|
|
||||||
|
|
||||||
|
# This class is part of an EXPERIMENTAL API.
|
||||||
|
class Metrics(object):
|
||||||
|
"""OTW-metrics service definition
|
||||||
|
"""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def CalcMetrics(request,
|
||||||
|
target,
|
||||||
|
options=(),
|
||||||
|
channel_credentials=None,
|
||||||
|
call_credentials=None,
|
||||||
|
insecure=False,
|
||||||
|
compression=None,
|
||||||
|
wait_for_ready=None,
|
||||||
|
timeout=None,
|
||||||
|
metadata=None):
|
||||||
|
return grpc.experimental.unary_unary(request, target, '/rowing_workout_metrics.Metrics/CalcMetrics',
|
||||||
|
rowing__workout__metrics__pb2.WorkoutMetricsRequest.SerializeToString,
|
||||||
|
rowing__workout__metrics__pb2.WorkoutMetricsResponse.FromString,
|
||||||
|
options, channel_credentials,
|
||||||
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def GetCP(request,
|
||||||
|
target,
|
||||||
|
options=(),
|
||||||
|
channel_credentials=None,
|
||||||
|
call_credentials=None,
|
||||||
|
insecure=False,
|
||||||
|
compression=None,
|
||||||
|
wait_for_ready=None,
|
||||||
|
timeout=None,
|
||||||
|
metadata=None):
|
||||||
|
return grpc.experimental.unary_unary(request, target, '/rowing_workout_metrics.Metrics/GetCP',
|
||||||
|
rowing__workout__metrics__pb2.CPRequest.SerializeToString,
|
||||||
|
rowing__workout__metrics__pb2.CPResponse.FromString,
|
||||||
|
options, channel_credentials,
|
||||||
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||||
|
|||||||
@@ -1477,7 +1477,6 @@ def handle_calctrimp(id,
|
|||||||
csvfile = csvfilename+'.gz'
|
csvfile = csvfilename+'.gz'
|
||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
csvfile = os.path.abspath(csvfile)
|
csvfile = os.path.abspath(csvfile)
|
||||||
|
|
||||||
with grpc.insecure_channel(
|
with grpc.insecure_channel(
|
||||||
|
|||||||
@@ -342,9 +342,9 @@ def isbreakthrough(delta, cpvalues, p0, p1, p2, p3, ratio):
|
|||||||
|
|
||||||
pwr *= ratio
|
pwr *= ratio
|
||||||
|
|
||||||
delta = delta.values.astype(int)
|
delta = delta.astype(int, errors='ignore').values
|
||||||
cpvalues = cpvalues.values.astype(int)
|
cpvalues = cpvalues.astype(int, errors='ignore').values
|
||||||
pwr = pwr.astype(int)
|
pwr = pwr.astype(int, errors='ignore').values
|
||||||
|
|
||||||
res = np.sum(cpvalues > pwr+1)
|
res = np.sum(cpvalues > pwr+1)
|
||||||
res2 = np.sum(cpvalues > pwr2+1)
|
res2 = np.sum(cpvalues > pwr2+1)
|
||||||
|
|||||||
Reference in New Issue
Block a user