Jump to content


P4Python - Performance and Global Options in commands

p4python performance connection

  • Please log in to reply
3 replies to this topic

#1 davide.digiannantonio

davide.digiannantonio

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 05 September 2013 - 04:18 PM

Hello,
is there a way in P4Python to issue this command?

p4 -r3 -vnet.maxwait=3 info

I need a fast way to test the server connection within few seconds, trying only 3 times.
Thank you...

#2 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 06 September 2013 - 05:14 PM

The -r flag is actually directly implemented in the command line; it runs the command in a for loop until it works or runs n times.

There's no method to set the debug level though, which is surprising to me. Looking at the code it wouldn't be hard for you to add one to P4Python; you'd just need to add a new command in "P4API.cpp" in the P4Python source to call p4debug.SetLevel() with the text you want.

#3 davide.digiannantonio

davide.digiannantonio

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 06 September 2013 - 05:34 PM

Thank you P4Matt,
but I'm sorry, I can't understand... what do you mean about the -r flag? Can we control it in Python?
How can be helpful to set the debug level?
And what about the net.maxwait?
Thank you again,
Davide

#4 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 06 September 2013 - 06:10 PM

The -r flag doesn't exist in the API; it's currently implemented in the command line directly. So in your case you'll want to do the same thing it does. Here's some pseudocode:

for( i = 0; i < 3; i++ )
{
	result = p4.run( "info" )
   if( result != 'some connection error" )
   {
	   break
	}
}

As to the 'vnet.maxwait=3' part, the '-v' indicates that it is a Perforce debug flag. It's a bit strange considering it is changing behavior; I would have thought it would be implemented as a protocol flag. Currently in P4Python there is method to set debug flags for the command. P4Python is open source, so if you wanted I think you could pretty easily add a method to your P4Python to set those debug flags.





Also tagged with one or more of these keywords: p4python, performance, connection

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users