09-04-2019 08:36 AM - edited 09-04-2019 08:38 AM
Following code works outside nso python package (default) or with in same python package:
import ncs
with ncs.maapi.Maapi() as m:
with ncs.maapi.Session(m, 'test', 'system'):
with m.start_write_trans() as t:
root = ncs.maagic .get_root(t)
device = root.devices.device ['MADDAL12']
input = device.sync_from.get_input()
input.wait_for_lock.create()
input.wait_for_lock.timeout = 60
result = device.sync_from(input)
print(result.result)
print(result.info)
How can i make it work among multiple NSO python packages. As we create new python vm or process when we create new NSO python packages. How can we control wait for lock and wait device for commits among different NSO python packages/VMs for same device if being used in multiple package at same time for sync-from and commits. One of them always fail. If it's just one package or with in default python VM it works fine. But not in multiple nso packages.
This will not be the case in Java Packages as there is only one VM.
what would be flag for commit wait-device in Maapi?
t.apply(True, maapi.COMMIT_NCS_WAIT_DEVICE) will this work if not what should be wait for lock in case of commits and also how to handle it in multiple Python VMs.
It's sort of tricky, any help and code snippets will be appreciated. i am still not able to figure out how to control locks between different NSO python packages for same device when accessed at same time for sync and commits.
01-28-2021 03:40 PM
Curious to know if you were able to find a solution for this issue.
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