Changeset 173 in tracdarcs for tracdarcs/command.py


Ignore:
Timestamp:
05/08/10 21:28:22 (2 years ago)
Author:
lele@…
Hash name:
20100508192822-97f81-b1bb7bbbea66114acc0c79d962bd856ff264cf23
Message:

Optional constraint on the number of concurrent darcs processes
A new option "darcs.max_concurrent_darcses" may set a limit on the
number of concurrent running darcs subprocesses. It is eventually
applied on a per repository basis. By default there are no limits, as
before.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tracdarcs/command.py

    r172 r173  
    4545    ''' 
    4646 
     47    RUNNING_DARCSES = None 
    4748    darcs_version = None 
    4849 
     
    7879        else: 
    7980            command = 'TZ=UTC ' + command 
    80         if self.log: 
    81             self.log.debug(command) 
    82         np = NaivePopen(command, input=input, capturestderr=True) 
     81 
     82        # Respect the maximum number of running darcs limit 
     83        if DarcsCommand.RUNNING_DARCSES is not None: 
     84            if self.log: 
     85                self.log.debug('Asking permission to run %s ...', command) 
     86            DarcsCommand.RUNNING_DARCSES.acquire() 
     87            if self.log: 
     88                self.log.debug('... got permission to run %s', command) 
     89        else: 
     90            if self.log: 
     91                self.log.debug(command) 
     92 
     93        try: 
     94            np = NaivePopen(command, input=input, capturestderr=True) 
     95        finally: 
     96            if DarcsCommand.RUNNING_DARCSES is not None: 
     97                DarcsCommand.RUNNING_DARCSES.release() 
     98 
    8399        if np.errorlevel: 
    84100            err = 'Running (%s) failed: %s, %s: %s' % (command, 
Note: See TracChangeset for help on using the changeset viewer.