-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: finished csv store, added test DAQJob
- Loading branch information
1 parent
c9f8a23
commit d105ee9
Showing
12 changed files
with
155 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
daq_job_type="store_csv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
daq_job_type="test" | ||
rand_min=1 | ||
rand_max=100 | ||
|
||
[store_config] | ||
daq_job_store_type="csv" | ||
file_path="test.csv" | ||
add_date=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from daq.store.csv import DAQJobStoreConfigCSV | ||
|
||
DAQ_STORE_CONFIG_TYPE_TO_CLASS = {"csv": DAQJobStoreConfigCSV} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import time | ||
from dataclasses import dataclass | ||
from random import randint | ||
|
||
from N1081B import N1081B | ||
|
||
from daq.base import DAQJob | ||
from daq.store.models import DAQJobMessageStore, StorableDAQJobConfig | ||
|
||
|
||
@dataclass | ||
class DAQJobTestConfig(StorableDAQJobConfig): | ||
rand_min: int | ||
rand_max: int | ||
|
||
|
||
class DAQJobTest(DAQJob): | ||
config_type = DAQJobTestConfig | ||
device: N1081B | ||
config: DAQJobTestConfig | ||
|
||
def start(self): | ||
while True: | ||
self.consume() | ||
self._send_store_message() | ||
|
||
time.sleep(1) | ||
|
||
def _send_store_message(self): | ||
def get_int(): | ||
return randint(self.config.rand_min, self.config.rand_max) | ||
|
||
self.message_out.put( | ||
DAQJobMessageStore( | ||
store_config=self.config.store_config, | ||
daq_job=self, | ||
keys=["A", "B", "C"], | ||
data=[[get_int(), get_int(), get_int()]], | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from daq.base import DAQJob | ||
from daq.caen.n1081b import DAQJobN1081B | ||
from daq.store.csv import DAQJobStoreCSV | ||
from daq.test_job import DAQJobTest | ||
|
||
DAQ_JOB_TYPE_TO_CLASS: dict[str, type[DAQJob]] = { | ||
"n1081b": DAQJobN1081B, | ||
"test": DAQJobTest, | ||
"store_csv": DAQJobStoreCSV, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters