onorua
onorua

Reputation: 399

Multithreading modules

One of my modules takes up to 5 minutes to execute due to underlying shell commands. I would like to change this and either make the executing asynchronous or start commands in separate threads/processes. Unfortunately I could not find any example of such approach.

Is it possible to run some steps of the module inside separate thread? Do you know example of it? I've been searching through modules inside salt repository, none is using multithreading nor multiprocessing, so I got lost.

Upvotes: 1

Views: 325

Answers (1)

dahrens
dahrens

Reputation: 3959

You usually want to be sure that your minion is in the correct state after you've executed:

salt '*' state.highstate

I guess that it is not meant to be asynchonous.

You might want to change your bash script to execute the stuff in seperate threads. I would use a language that i know - python or nodejs. It mostly depends on what this bash script actually does.

Upvotes: 1

Related Questions