- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
12-08-2023 12:04 AM
#Cortex XSOAR
Hi,
Is there a way of creating parallel processing inside an automation in Python ?
My goal is to execute the same function on multiple incidents (pausing and/or starting timers).
The thing is, sometimes we have a lot of incidents and the current automation using a mere "for x in y" can timeout.
Obviously we could increase the timeout and/or retry on error but for the same number of incidents it can take from 3 to more than 10 minutes (we do not know the reason)
It seems we can import "Process" or "Threading". While Process does not seems to work, Threading does but without time improvement.
Many thanks for your help.
Best regards,
01-19-2024 12:43 PM
Hello,
Are your system specs up to requirement? Please take a look at this doc to ensure you have the minimum recommended specs https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/6.12/Cortex-XSOAR-Installation-Guide/Install...
The reason for this is that every single task in XSOAR requires a worker and if there are no workers available you could see these sort of issues occurring. However, if this a concern with a specific task that is timing out I would recommend to create a support ticket to ensure that there isn't something else going on that needs to be addressed before any more complication gets introduced into the equation.
Furthermore, I do not recommend creating a script with multithreading capabilities or that works on multiple incidents at the same time as this would interrupt the flow of logical execution of each incident. XSOAR is not made for this sort of execution and troubleshooting it would not be supported by any of our OOTB debugging tools.
01-21-2024 01:06 PM
For this you need to
demisto.executeCommand("getIncidents", {
'query':query_inc,
'fromdate': from_date,
'populateFields' : 'your fields'
})
Above command will get your required incidents information then get incident ids of it.
Make your function and run it over your incident ids using setPlaybook.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!