Skip to content

Commit

Permalink
implement end of day sequence rollover
Browse files Browse the repository at this point in the history
  • Loading branch information
petersilva committed Apr 27, 2024
1 parent a3d3767 commit 77ab182
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion sarracenia/flowcb/filter/wmo00_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import os
import random
import sarracenia
import time

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -58,11 +59,19 @@ def __init__(self,options) :
self.sequence=0
logger.info( f"main sequence initialized: {self.sequence} ")

self.thisday=time.gmtime().tm_mday


def after_accept(self,worklist):

if len(worklist.incoming) == 0:
return

today=time.gmtime().tm_mday
if today != self.thisday:
self.thisday=today
self.sequence=1

grouped_file=f"{self.o.work_directory}/{self.o.wmo_origin_CCCC}{self.sequence_first_digit}{self.o.no:02d}{self.sequence:06d}.{self.o.wmo_type_marker}"
output_file=open(grouped_file,"wb")

Expand Down Expand Up @@ -110,7 +119,7 @@ def after_accept(self,worklist):
if self.sequence > 999999:
self.sequence == 0



def on_stop(self):

Expand Down

1 comment on commit 77ab182

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report •
FileStmtsMissCoverMissing
flowcb/filter
   wmo00_write.py68680%21–27, 29, 31, 34–38, 41–45, 47–48, 51–52, 54–57, 59–60, 62, 65, 67–68, 70–73, 75–76, 78–84, 86–88, 91, 94, 99–100, 104, 108–110, 112–113, 115–116, 118–120, 124, 126–127, 129
TOTAL154331259718% 

Test Results

Tests Skipped Failures Errors Time
209 8 💤 0 ❌ 0 🔥 16.967s ⏱️

Please sign in to comment.