Ejemplo n.º 1
0
 def add(self, input):
     from Ganga.Core.GangaRepository import getRegistry
     if not isType(input, list):
         input = [input]
     for item in input:
         if isType(item, str):
             if os.path.isfile(expandfilename(item)):
                 logger.info('Copying file %s to shared directory %s' %
                             (item, self.name))
                 shutil.copy2(expandfilename(item),
                              os.path.join(getSharedPath(), self.name))
                 shareref = GPIProxyObjectFactory(
                     getRegistry("prep").getShareRef())
                 shareref.increase(self.name)
                 shareref.decrease(self.name)
             else:
                 logger.error('File %s not found' % expandfilename(item))
         elif isType(item, File) and item.name is not '' and os.path.isfile(
                 expandfilename(item.name)):
             logger.info('Copying file object %s to shared directory %s' %
                         (item.name, self.name))
             shutil.copy2(expandfilename(item.name),
                          os.path.join(getSharedPath(), self.name))
             shareref = GPIProxyObjectFactory(
                 getRegistry("prep").getShareRef())
             shareref.increase(self.name)
             shareref.decrease(self.name)
         else:
             logger.error('File %s not found' % expandfilename(item.name))
Ejemplo n.º 2
0
 def decrementShareCounter(self, shared_directory_name, remove=0):
     """
     Function which is used to decrement the number of (sub)jobs which share the prepared sandbox
     managed by this app
     Args:
         shared_directory_name (str): full name of directory managed by this app
     """
     remove = remove
     logger.debug('Decrementing shared directory reference counter')
     shareref = GPIProxyObjectFactory(getRegistry("prep").getShareRef())
     shareref.decrease(shared_directory_name, remove)
Ejemplo n.º 3
0
 def decrementShareCounter(self, shared_directory_name, remove=0):
     """
     Function which is used to decrement the number of (sub)jobs which share the prepared sandbox
     managed by this app
     Args:
         shared_directory_name (str): full name of directory managed by this app
     """
     remove = remove
     logger.debug('Decrementing shared directory reference counter')
     shareref = GPIProxyObjectFactory(getRegistry("prep").getShareRef())
     shareref.decrease(shared_directory_name, remove)
Ejemplo n.º 4
0
 def add(self, input):
     if not isType(input, list):
         input = [input] 
     for item in input:
         if isType(item, str):
             if os.path.isfile(expandfilename(item)):
                 logger.info('Copying file %s to shared directory %s'%(item, self.name))
                 shutil.copy2(expandfilename(item), os.path.join(shared_path,self.name))
                 shareref = GPIProxyObjectFactory(getRegistry("prep").getShareRef())
                 shareref.increase(self.name)
                 shareref.decrease(self.name)
             else:
                 logger.error('File %s not found' % expandfilename(item))
         elif isType(item,File) and item.name is not '' and os.path.isfile(expandfilename(item.name)):
             logger.info('Copying file object %s to shared directory %s'%(item.name,self.name))
             shutil.copy2(expandfilename(item.name), os.path.join(shared_path,self.name))
             shareref = GPIProxyObjectFactory(getRegistry("prep").getShareRef())
             shareref.increase(self.name)
             shareref.decrease(self.name)
         else:
             logger.error('File %s not found' % expandfilename(item.name))
Ejemplo n.º 5
0
 def decrementShareCounter(self, shared_directory_name, remove=0):
     remove=remove
     logger.debug('Decrementing shared directory reference counter')
     shareref = GPIProxyObjectFactory(getRegistry("prep").getShareRef())
     shareref.decrease(shared_directory_name, remove)
Ejemplo n.º 6
0
 def decrementShareCounter(self, shared_directory_name, remove=0):
     remove = remove
     logger.debug('Decrementing shared directory reference counter')
     shareref = GPIProxyObjectFactory(getRegistry("prep").getShareRef())
     shareref.decrease(shared_directory_name, remove)