Commit 66ea3914 authored by Philip ABBET's avatar Philip ABBET
Browse files

Update test database 'large/1'

parent 386fe36f
Pipeline #17090 failed with stage
in 0 seconds
......@@ -26,48 +26,63 @@
###############################################################################
import numpy
from collections import namedtuple
from beat.backend.python.database import View
class LargeView:
#----------------------------------------------------------
def setup(self, root_folder, outputs, parameters):
class LargeView(View):
def __init__(self):
super(LargeView, self).__init__()
numpy.random.seed(0) # So it is kept reproducible
self.outputs = outputs
return True
def done(self, last_data_index):
return (last_data_index == 1000)
def index(self, root_folder, parameters):
Entry = namedtuple('Entry', ['out'])
entries = []
for i in range(0, 1000):
entries.append(numpy.int32(numpy.random.randint(100, size=(1000000,))))
return entries
def next(self):
val = numpy.int32(numpy.random.randint(100, size=(1000000,)))
self.outputs['out'].write({
'value': val,
})
def get(self, output, index):
obj = self.objs[index]
return True
if output == 'out':
return {
'value': obj.out
}
#----------------------------------------------------------
class SmallView:
def setup(self, root_folder, outputs, parameters):
class SmallView(View):
def __init__(self):
super(LargeView, self).__init__()
numpy.random.seed(0) # So it is kept reproducible
self.outputs = outputs
return True
def done(self, last_data_index):
return (last_data_index == 1000)
def index(self, root_folder, parameters):
Entry = namedtuple('Entry', ['out'])
entries = []
for i in range(0, 1000):
entries.append(numpy.int32(numpy.random.randint(0, 100)))
return entries
def next(self):
val = numpy.int32(numpy.random.randint(0, 100))
self.outputs['out'].write({
'value': val,
})
def get(self, output, index):
obj = self.objs[index]
return True
if output == 'out':
return {
'value': obj.out
}
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