You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a script which runs a main Nornir task, let's call it task1 and several sub-tasks inside task1, let's call it task2, taskN.
taskN is the last task and it attempts to commit changes based on user inputs: Y / N.
I would like to run each task before taskN in a threaded way but taskN should run with num_workers as 1.
Based on the documentation, https://nornir.readthedocs.io/en/latest/plugins/execution_model.html this is possible.
When I enter the argument in the following way:
task.run(task=taskN, num_workers = 1)
I get the error described in the title:
TypeError: taskN() got an unexpected keyword argument 'num_workers'
Nornir version which is running is 3.4.1.
I would appreciate any suggestions on how to achieve this without modifying the core_options and running every task in a non-threaded way.
Thanks,
Jesús
The text was updated successfully, but these errors were encountered:
@Jesus-Gonzalez-Alight You probably need to think of a different pattern. Basically once you call Task1 you are going to be in a child thread and all of the sub-tasks (Task2...TaskN) would be inside of that child thread. So what you are asking is to somehow go from the child thread back to the main thread.
So that is what you should really be thinking about doing--end Task1 and pass back whatever data you need (from Task1) and then back in the main thread (outside of the initial Task1 call), execute this last TaskN. For executing this last TaskN, there are different ways you could do this (to make it be non-threaded). I would probably look at these environment variables:
Hello Community,
I have a script which runs a main Nornir task, let's call it task1 and several sub-tasks inside task1, let's call it task2, taskN.
taskN is the last task and it attempts to commit changes based on user inputs: Y / N.
I would like to run each task before taskN in a threaded way but taskN should run with num_workers as 1.
Based on the documentation, https://nornir.readthedocs.io/en/latest/plugins/execution_model.html this is possible.
When I enter the argument in the following way:
task.run(task=taskN, num_workers = 1)
I get the error described in the title:
TypeError: taskN() got an unexpected keyword argument 'num_workers'
Nornir version which is running is 3.4.1.
I would appreciate any suggestions on how to achieve this without modifying the core_options and running every task in a non-threaded way.
Thanks,
Jesús
The text was updated successfully, but these errors were encountered: