06-09-2022 01:18 AM
Hello,
I'm trying to write a python action in which I need to make two commit. For that I tried to open two write transaction separately. My python code look like this:
class Action(Action):
@Action.action
def cb_action(self, uinfo, name, kp, input, output, trans):
# Open the first transaction
with ncs.maapi.single_write_trans(uinfo.username, 'python') as t:
root = ncs.maagic.get_root(t)
#First transaction code ....
t.set_comment("First commit")
t.apply()
# Open the second transaction
with ncs.maapi.single_write_trans(uinfo.username, 'python') as t1:
# Second transaction code ...
t1.set_comment("Second commit")
t1.apply()
The first commit take place successfully but the second one don't occur. I'm wondering why such behaviour is happenning and if there a way to fix it.
Thanks,
06-09-2022 10:26 AM - edited 06-09-2022 10:27 AM
Hello ,
Can you provide us more detail about the error message that you get ?
By default action and service have a timeout 120 seconds . If after the 120 sec the action or service didn’t complete the execution . It will abort.
In your case try to add some logs to see how much every transaction take. For action you can change the timeout from your action code .I Think if you change the timeout it’s going to fix your issue.
For the service , you need to change the default value in the CDB.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide