1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 <2024> 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 <2024> 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Commands with synchronous answers from python |
From: | Matthew Newville via Tech-talk <tech-talk at aps.anl.gov> |
To: | "Neidherr, Dennis Dr." <D.Neidherr at gsi.de>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>, Érico Nogueira Rolim <erico.rolim at lnls.br> |
Date: | Mon, 26 Feb 2024 20:12:59 +0000 |
This Message Is From an External Sender
This message came from outside your organization.
I could be misunderstanding the goal, but it seems slightly odd to explicitly use async and await, but then want things to be synchronized.
Have you considered something like (using pyepics: `
pip install pyepics `): from epics import caget, caput
def do_stuff():
caput('Variable.PROC', 1, wait=True, timeout=10)
test = caget('Variable.VAL')
print(str(test))
while True:
do_stuff()
# may want to add some delay or other step
here,
# unless the goal is to push PROC as often
as possible.
That should wait for the put() to complete and fully process the record before going on to the next statement.
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Érico Nogueira Rolim via Tech-talk <tech-talk at aps.anl.gov>
Sent: Monday, February 26, 2024 1:37 PM To: Neidherr, Dennis Dr. <D.Neidherr at gsi.de>; tech-talk at aps.anl.gov <tech-talk at aps.anl.gov> Subject: Re: Commands with synchronous answers from python
This Message Is From an External Sender
This message came from outside your organization.
Hi! Response is inline
On 26/02/2024 06:51, Neidherr, Dennis Dr. via Tech-talk wrote:
Hello and welcome!
To be sure the record has been processed once you use `caget`, you could check some timestamp field from the AugmentedValue return value. Comparing it to your last known timestamp can tell you whether the PV has been processed since you last checked.
However, since busy looping on that is not a good pattern, you should probably use the `camonitor` interface from aioca instead; the library itself will let you know when there is an event for the record. I don't know if this keeps your "atomic" property (though I don't believe the original was atomic either). Can you explain why you need this to be atomic? What sort of actions does the record perform? I don't think that's a common pattern, especially when controlling records from outside of the IOC (I am welcome to corrections on that).
Cheers Érico Aviso Legal: Esta mensagem e seus anexos podem conter informações confidenciais e/ou de uso restrito. Observe atentamente seu conteúdo e considere eventual consulta ao remetente antes de copiá-la, divulgá-la ou distribuí-la. Se você recebeu esta mensagem por engano, por favor avise o remetente e apague-a imediatamente. Disclaimer: This email and its attachments may contain confidential and/or privileged information. Observe its content carefully and consider possible querying to the sender before copying, disclosing or distributing it. If you have received this email by mistake, please notify the sender and delete it immediately. |