Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
appyens
Participant

Can I login to web_api with same user from 3 python scripts simultaneously.

Hello,

Can I login to web_api with same user from 3 python scripts simultaneously.

These 3 scripts will do - login --> add host --> add access rule --> publish --> install policy --> logout.

can 3 python scripts trigger this series of operations parallelly.

 

0 Kudos
3 Replies
PhoneBoy
Admin
Admin

Prior to R80.20, no, as the same user is unable to create multiple sessions.
Even in R80.20+ only one Install Policy action is allowed to take place at a time, but the other operations can happen in parallel.
appyens
Participant

So is there any way via web_api to know that user is already logged in or user has logged out. so that I can trigger these scripts one by one. (only web_api)
0 Kudos
PhoneBoy
Admin
Admin

You'd have to query the show sessions API with a different user to get the active sessions, then iterate over each one to see if there are any sessions by the user in question.
Seriously, though, if you're running R80 or R80.10, you should really upgrade.

If you're running R80.20+, assuming the scripts are modifying different objects/rules, you should have no trouble running the scripts concurrently.
The only command that is not supported in parallel is install policy.
You should be error-checking for policy install failures.
If it's because another policy is already installing, you should be able to determine this by reviewing the error you get and/or reviewing the running tasks.

That said, I'm not sure what you are doing is the correct approach.
Are all of these policy installs to the same gateway or different ones?
And keep in mind that policy installs can be disruptive to running traffic depending on a number of factors, so you want to keep plicy pushes to a minimum.
0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events