Skip to content

Commit e029b9f

Browse files
committed
optimized report template
1 parent 4d2d251 commit e029b9f

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

examples/logging_and_report/generic_pipe_2f78d74c.py

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,13 @@ def __init__(self, id, config, inputData, return_queue, cmd_queue):
1212

1313
def execute(self):
1414

15+
output = None
16+
if self.inputData == '5m':
17+
t0 = int(time.time()) # get current unix time
18+
t1 = t0 - (60 * 5) # calculate unix stamp time 5 minutes ago
1519

16-
#####################################
17-
# #
18-
# REFERENCE IMPLEMENTATION #
19-
# #
20-
#####################################
20+
output = 'SELECT * FROM my_table WHERE timestamp BETWEEN {} AND {}'.format(t1, t0)
2121

2222

23-
24-
if self.inputData is None:
25-
output = 0
26-
else:
27-
output = self.inputData + 1
28-
29-
30-
31-
#########################################
32-
# #
33-
# The execution exits immediately #
34-
# after providing output data #
35-
# #
36-
#########################################
37-
38-
recordDone = Record(output, 'Sending value of cnt: {}'.format(output))
23+
recordDone = Record(output)
3924
self.return_queue.put(recordDone)
3.66 KB
Binary file not shown.

0 commit comments

Comments
 (0)