03 Feb 2024, Pavel Murat, Bug Report, string --> int64 conversion in the python interface ?
|
Dear MIDAS experts,
I gave a try to the MIDAS python interface and ran all tests available in midas/python/tests.
Two Int64 tests from test_odb.py had failed (see below), everthong else - succeeded
I'm using a ~ 2.5 weeks-old commit and python 3.9 on SL7 Linux platform.
commit c19b4e696400ee437d8790b7d3819051f66da62d (HEAD -> develop, origin/develop, origin/HEAD)
Author: Zaher Salman <zaher.salman@gmail.com>
Date: Sun Jan 14 13:18:48 2024 +0100
The symptoms are consistent with a string --> int64 conversion not happening
where it is needed.
Perhaps the issue have already been fixed?
-- many thanks, regards, Pasha
-------------------------------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mu2etrk/test_stand/pasha_020/midas/python/tests/test_odb.py", line 178, in testInt64
self.set_and_readback_from_parent_dir("/pytest", "int64_2", [123, 40000000000000000], midas.TID_INT64, True)
File "/home/mu2etrk/test_stand/pasha_020/midas/python/tests/test_odb.py", line 130, in set_and_readback_from_parent_dir
self.validate_readback(value, retval[key_name], expected_key_type)
File "/home/mu2etrk/test_stand/pasha_020/midas/python/tests/test_odb.py", line 87, in validate_readback
self.assert_equal(val, retval[i], expected_key_type)
File "/home/mu2etrk/test_stand/pasha_020/midas/python/tests/test_odb.py", line 60, in assert_equal
self.assertEqual(val1, val2)
AssertionError: 123 != '123'
with the test on line 178 commented out, the test on the next line fails in a similar way:
Traceback (most recent call last):
File "/home/mu2etrk/test_stand/pasha_020/midas/python/tests/test_odb.py", line 179, in testInt64
self.set_and_readback_from_parent_dir("/pytest", "int64_2", 37, midas.TID_INT64, True)
File "/home/mu2etrk/test_stand/pasha_020/midas/python/tests/test_odb.py", line 130, in set_and_readback_from_parent_dir
self.validate_readback(value, retval[key_name], expected_key_type)
File "/home/mu2etrk/test_stand/pasha_020/midas/python/tests/test_odb.py", line 102, in validate_readback
self.assert_equal(value, retval, expected_key_type)
File "/home/mu2etrk/test_stand/pasha_020/midas/python/tests/test_odb.py", line 60, in assert_equal
self.assertEqual(val1, val2)
AssertionError: 37 != '37'
--------------------------------------------------------------------------- |
05 Feb 2024, Pavel Murat, Forum, forbidden equipment names ?
|
Dear MIDAS experts,
I have multiple daq nodes with two data receiving FPGAs on the PCIe bus each.
The FPGAs come under the names of DTC0 and DTC1. Both FPGAs are managed by the same slow control frontend.
To distinguish FPGAs of different nodes from each other, I included the hostname to the equipment name,
so for node=mu2edaq09 the FPGA names are 'mu2edaq09:DTC0' and 'mu2edaq09:DTC1'.
The history system didn't like the names, complaining that
21:26:06.334 2024/02/05 [Logger,ERROR] [mlogger.cxx:5142:open_history,ERROR] Equipment name 'mu2edaq09:DTC1'
contains characters ':', this may break the history system
So the question is : what are the safe equipment/driver naming rules and what characters
are not allowed in them? - I think this is worth documenting, and the current MIDAS docs at
https://daq00.triumf.ca/MidasWiki/index.php/Equipment_List_Parameters#Equipment_Name
don't say much about it.
-- many thanks, regards, Pasha |
11 Feb 2024, Pavel Murat, Forum, number of entries in a given ODB subdirectory ?
|
> For ODB keys of type TID_KEY, the value num_values IS the number of subkeys.
this logic makes sense, however it doesn't seem to be consistent with the printout of the test example
at the end of https://daq00.triumf.ca/elog-midas/Midas/240203_095803/a.cc . The printout reports
key.num_values = 1, but the actual number of subkeys = 6, and all subkeys being of TID_KEY type
I'm certain that the ODB subtree in question was not accessed concurrently during the test.
-- regards, Pasha |
19 Feb 2024, Pavel Murat, Forum, number of entries in a given ODB subdirectory ?
|
> > Hmm... is there any use case where you want to know the number of directory entries, but you will not iterate
> > over them later?
>
> I agree.
here comes the use case:
I have a slow control frontend which monitors several DAQ components - software processes.
The components are listed in the system configuration stored in ODB, a subkey per component.
Each component has its own driver, so the length of the driver list, defined by the number of components,
needs to be determined at run time.
I calculate the number of components by iterating over the list of component subkeys in the system configuration,
allocate space for the driver list, and store the pointer to the driver list in the equipment record.
The approach works, but it does require pre-calculating the number of subkeys of a given key.
-- regards, Pasha |
27 Feb 2024, Pavel Murat, Forum, displaying integers in hex format ?  
|
Dear MIDAS Experts,
I'm having an odd problem when trying to display an integer stored in ODB on a custom
web page: the hex specifier, "%x", displays integers as if it were "%d" .
- attachment 1 shows the layout and the contents of the ODB sub-tree in question
- attachment 2 shows the web page as it is displayed
- attachment 3 shows the snippet of html/js producing the web page
I bet I'm missing smth trivial - an advice is greatly appreciated!
Also, is there an equivalent of a "0x%04x" specifier to have the output formatted
into a fixed length string ?
-- thanks, regards, Pasha |
27 Feb 2024, Pavel Murat, Forum, displaying integers in hex format ?
|
Hi Stefan (and Ben),
thanks for reacting so promptly - your commits on Bitbucket fixed the problem.
For those of us who knows little about how the web browsers work:
- picking up the fix required flushing the cache of the MIDAS client web browser - apparently the web browser
I'm using - Firefox 115.6 - cached the old version of midas.js but wouldn't report it cached and wouldn't load
the updated file on its own.
-- thanks again, regards, Pasha |
04 Jul 2024, Pavel Murat, Suggestion, cmake-installing more files ?
|
Dear all,
this posting results from the Fermilab move to a new packaging/build system called spack
which doesn't allow to use the MIDAS install procedure described at
https://daq00.triumf.ca/MidasWiki/index.php/Quickstart_Linux#MIDAS_Package_Installation
as is. Spack specifics aside, building MIDAS under spack took
a) adding cmake install for three directories: drivers, resources, and python/midas,
b) adding one more include file - include/tinyexpr.h - to the list of includes installed by cmake.
With those changes I was able to point MIDASSYS to the spack install area and successfully run mhttpd,
build experiment-specific C++ frontends and drivers, use experiment-specific python frontends etc.
I'm not using anything from MIDAS submodules though.
I'm wondering what the experts would think about accepting the changes above to the main tree.
Installation procedures and changed to cmake files are always a sensitive area with a lot of boundary
constraints coming from the existing use patterns, and even a minor change could have unexpected consequences
So I wouldn't be surprised if the fairly minor changes outlined above had side effects.
The patch file is attached for consideration.
-- regards, Pasha |
24 Nov 2024, Pavel Murat, Bug Report, ODB lock timeout, Difficulty running MIDAS on Rocky 9.4
|
there is a really good software tool developed by the Fermilab DAQ group, called TRACE -
https://github.com/art-daq/trace ,
It could be useful for debugging cases like this one. In short, TRACE instruments the code
with the printouts which could be selectively turned on and off without recompiling the executable.
TRACE output could go to /dev/stdout (slow output) and/or to a circular buffer implemented via a shared
memory segment (fast output). Sending unlimited output to the shared memory segment is extremely useful.
TRACE also allows to trigger on certain conditions, again, w/o recompiling the executable.
For debugging cases like the one in question, that could turn out even more useful,
however I didn't try the triggering functionality myself.
-- regards, Pasha |
30 Nov 2024, Pavel Murat, Bug Report, EQ_PERIODIC-only equipment ?
|
Dear Midas experts,
I'm running into something which looks like an initialization problem.
I have a mfe.cxx-style frontend which introduces an equipment of the EQ_PERIODIC type (EQ_PERIODIC-only!).
When Midas enters the running state, I see the frontend crashing.
Stepping through the code shows that the frontend is crashing because its equipment has been ignored
by the initialize_equipment@mfe.cxx - see
https://bitbucket.org/tmidas/midas/src/5d0dae001712164ae43137dced2fbbb594f0201e/src/mfe.cxx#lines-630
Is there an assumption that the initialization of the EQ_PERIODIC-only equipment is the user responsibility?
Or EQ_PERIODIC should always come paired with some other type?
-- many thanks, regards, Pasha |
01 Dec 2024, Pavel Murat, Bug Report, EQ_PERIODIC-only equipment ?
|
> There is no requirement that you pair an EQ_PERIODIC with an EQ_TRIGGER. Take for exmaple
>
> midas/examples/experiment/frontend.cxx
>
> and remove there the triggered event. The frontend runs happily with the periodic event only (I just tried that myself). You have probably some problem in
> your event definition. Start with the running example frontend, and add your code line by line until you see the problem.
Hi Stefan, thank you very much!
As the pointer to the readout function and pointers to device drivers are all defined in the same structure (EQUIPMENT),
I was naively assuming that the readout function should be set during the class driver initialization.
Now it is clear that the equipment responding to EQ_PERIODIC events doesn't have to have drivers,
and specifying the readout function is the responsibility of the user.
I got around exactly this way yesterday, but was thinking that I was hacking the system :)
-- regards, Pasha |
29 Dec 2024, Pavel Murat, Forum, time ordering of run transition calls to TMFeEquipment things
|
Dear MIDAS experts,
I have a question about "tmfe approach" to implementing MIDAS frontends. If I read the code correctly,
within this approach it is the TMFeEquipment things, not the TMFrontend's themselves,
which handle the run transitions - the TMFrontend class
https://bitbucket.org/tmidas/midas/src/423082fb67c7711813fcda61f7cd03784c398f49/include/tmfe.h#lines-306:378
simply doesn't have methods to handle those directly.
So how does a user control the sequence in which TMFeEquipment::HandleBeginRun functions of different
TMFeEquipment pieces are called at begin run? - there are two cases to consider: TMFeEquipment things
defined by the same TMFrontend and by different TMFrontend's.
Many thanks and happy holidays to everyone!
-- regards, Pasha
|
02 Jan 2025, Pavel Murat, Forum, time ordering of run transition calls to TMFeEquipment things
|
Hi K.O., your clarification is much appreciated!
"
> I am not sure what you are trying to do. It is always easier to suggest a solution to a specific problem.
I think, I owe you an explanation :) :
Consider ~ 40 nodes with two FPGAs (PCIE cards) per node, talking to the detector hardware.
One of those FPGAs, in addition to reading the data, performs the global timing synchronization.
The high-bandwidth data readout is not controlled by MIDAS, so all frontends perform only 'slow control'-type functions.
In MIDAS language, an FPGA implements two different units of slow control equipment:
one - configuring and controlling a single FPGA (equipment type A), and another one - synchronizing
multiple FPGAs (equipment type B). On one of the nodes, unit A and unit B share the FPGA card,
so they better be controlled by the same frontend.
For one, I need to make sure that all type A equipment units, managed by multiple frontends,
are initialized before the [single] type B unit which shares the frontend with the type A unit.
And, of course, the end of a run transition has to be handled in the opposite order - type B unit
shuts down first.
As 'periodic' actions for all registered pieces of equipment are performed in the same loop [thread],
registering the equipment in the needed order - first A, then B - should give a solution - thanks for making that clear.
>
> 1) "time ordering of run transitions" - of course midas transitions are ordered by transition sequence numbers
> and the tmfe class provides methods to control this. ditto for the mfe.cxx frontends.
>
> 2) for one TMFrontend, the order of calling HandleBeginRun() is the order in which equipments were added to the
> equipment using FeAddEquipment(). HandleEndRun() is called in reverse order. (I better check this).
the ordering of the rpc handler calls in tmfe's tr_stop/tr_pause/tr_resume functions is ok.
>
> 3) to have multiple TMFrontends in one program would be unusual (mfe.cxx frontends completely do not support
> this), but should work. Everything was coded to support this, but it was never tested in practice because we
> cannot invent any useful use-case for it. HandleBeginRun() handlers are likely to be called in the frontends are
> created. (I could check this and confirm it works, as long as you have a valid use-case for this configuration).
agreed, I don't think there is a good use case for that, so no need to spend time checking.
>
> 4) Frontend X has EquipmentA and EquipmentB, you want EqA::HandleBeginRun() to be called at run transition 200
> and EqB::HandleBeginRun() to be called at run transition 400.
>
> This is not directly supported by mfe.cxx frontends (the begin_run() handler is a global function) and I did not
> directly implement it in the TMFE frontend.
>
> But I think this would be a useful improvement. I will look into this.
In the simplest case, registering the equipment units in the right order is definitely the answer.
However a single FPGA can perform multiple logically independent tasks and thus represent
multiple logical units of equipment. Those units however are not independent: they share the hardware (FPGA)
and thus do depend on each other. Giving users a full control over the sequence in which those logical units
execute their run transitions is quite likely to be needed, for example, to work around peculiarities of the
custom-made kernel drivers.
>
> Likely I will add per-equipment data members fEqConfBeginRunSeqNo, fEqConfEndRunSeqno, etc. Value 0 would
> unregister the corresponding run transition handler. This would cleanup the code quite a bit, a bunch
> of RegisterTranstionXXX functions could go away.
this also makes sense. -- thanks again, regards, Pasha
>
> K.O. |
18 Jan 2025, Pavel Murat, Forum, mjsonrpc: how to increase the max allowed length of the callback response ?
|
Dear MIDAS experts,
I'm using MIDAS javascript interface (mjsonrpc) to communicate with a frontend from a custom web page
and observe that the if the frontend's response exceeds certain number of bytes, it is always truncated.
MIDAS C/C++ RPC interface allows users to specify the max response length :
https://daq00.triumf.ca/MidasWiki/index.php/Remote_Procedure_Calls_(RPC)#C++_2
How would one do the same from with mjsonrpc ?
-- many thanks, regards, Pasha |
30 Jan 2025, Pavel Murat, Forum, converting non-MIDAS slow control data into MIDAS history format ?
|
Dear MIDAS experts,
I have a time series of slow control measurements in an ASCII format -
data records in a format (run_number, time, temperature, voltage1, ..., voltageN),
and, if possible, would like to convert them into a MIDAS history format.
Making MIDAS events out of that data is easy, but is it possible to preserve
the time stamps? - Logically, this boils down to whether it is possible to have
the event time set by a user frontend
-- as always - many thanks, regards, Pasha |
31 Jan 2025, Pavel Murat, Forum, converting non-MIDAS slow control data into MIDAS history format ?
|
I think I found an answer to my question: a user-controlled event header does have a time stamp:
https://daq00.triumf.ca/MidasWiki/index.php/Event_Structure#Event_Header
-- apologies for the spam, regards, Pasha |
01 Feb 2025, Pavel Murat, Bug Report, MIDAS history system not using the event timestamps ? 
|
> I have a time series of slow control measurements in an ASCII format -
> data records in a format (run_number, time, temperature, voltage1, ..., voltageN),
> and, if possible, would like to convert them into a MIDAS history format.
>
> Making MIDAS events out of that data is easy, but is it possible to preserve
> the time stamps? - Logically, this boils down to whether it is possible to have
> the event time set by a user frontend
It looks that the original question was not as naive as I expected and may be pointing to a subtle bug.
I have implemented a python frontend - essentially a clone of
https://bitbucket.org/tmidas/midas/src/develop/python/midas/frontend.py
reading the old slow control data and setting the event.header.timestamp's to some dates from the year of 2022.
When I run MIDAS and read the "old slow control events", one event in 10 seconds,
the MIDAS Event Dump utility shows the data with the correct event timestamps, from the year of 2022.
However the history plots show the event parameters with the timestamps from Feb 01 2025 and the adjacent
data points separated by 10 sec.
Is it possible that the history system uses its own timestamp setting instead of using timestamps from the event headers?
- Under normal circumstances, the two should be very close, and that could've kept the issue hidden...
-- thanks, regards, Pasha
UPDATE: I attached the frontend code and the input data file it is reading. The data file should reside in the local directory
- the frontend code doesn't have everything fully automated for the test,
-- an integer field "/Mu2e/Offline/Ops/LastTime" would need to be created manually
-- the history plots would need to be declared manually |
01 Apr 2025, Pavel Murat, Bug Report, MIDAS history system not using the event timestamps ?
|
Dear MIDAS experts,
I confirm that when writing out history files corresponding to the slow control event data,
MIDAS history system timestamps the data not with the event time coming from the event data,
but with the current time determined by the program -
https://bitbucket.org/tmidas/midas/src/293d27fad0c87c80c4ed7b94b5c40ba1e150bea4/progs/mlogger.cxx#lines-5321
where 'now' is defined as
time_t now = time(NULL);
I'm looking for a way to timestamp the history data with the event time - that is important
for HEP applications outside the DAQ domain. Yes, MIDAS infrastructure is very well suited for that,
there could have a number of such applications, and experiments could significantly benefit from that.
So I'm wondering whether the implementation is a design choice made or it could be changed.
The change itself and especially its validation may require a non-negligible amount of work - I'd be happy to contribute.
Any insight much appreciated.
-- thanks, regards, Pasha |
01 Apr 2025, Pavel Murat, Suggestion, Sequencer ODBSET feature requests
|
I once looked at using LUA for this,
> but I think basing off an full featured programming language like python
> is better.
if it came to a vote, my vote would go to Lua: it would allow to do everything needed,
with much less external dependencies and with much less motivation to over-use the interpreter.
The CMS experience was very teaching in this respect...
-- my 2c, regards, Pasha |
02 Apr 2025, Pavel Murat, Bug Report, MIDAS history system not using the event timestamps ?
|
> You can always include your "true" data timestamp as the first value in your data.
Are you saying that if the first data word of a history event were a timestamp,
the MIDAS history system, when plotting the time dependencies, would use that timestamp
instead of the mlogger timestamp?
if that is true, what tells MIDAS that the first data word is the timestamp?
I couldn't find a discussion of that on the page describing the history system -
https://daq00.triumf.ca/MidasWiki/index.php/History_System#Frontend_history_event
- perhaps I should be looking at a different page?
-- thanks again, regards, Pasha |
29 Apr 2025, Pavel Murat, Bug Report, ODBXX : ODB links in the path names ?
|
Dear MIDAS experts,
does the ODBXX interface to ODB currently ODB links in the path names? - From what I see so far, it currently fails to do so,
but I could be doing something else wrong...
-- thanks, regards, Pasha |
|