cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
757
Views
0
Helpful
1
Replies

wait-for-lock and wait-device in nso python packages

azhasale
Cisco Employee
Cisco Employee

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.

1 Reply 1

robert.lee2
Level 1
Level 1

Curious to know if you were able to find a solution for this issue.