CMS 3D CMS Logo

List of all members | Public Member Functions
production_tasks.GZipFiles Class Reference
Inheritance diagram for production_tasks.GZipFiles:
production_tasks.Task

Public Member Functions

def __init__ (self, dataset, user, options)
 
def gzip (self, fileName)
 
def run (self, input)
 
- Public Member Functions inherited from production_tasks.Task
def __init__ (self, name, dataset, user, options, instance=None)
 
def addOption (self, parser)
 
def getname (self)
 
def run (self, input)
 

Additional Inherited Members

- Public Attributes inherited from production_tasks.Task
 dataset
 
 instance
 
 name
 
 options
 
 user
 

Detailed Description

GZip a list of files

Definition at line 169 of file production_tasks.py.

Constructor & Destructor Documentation

def production_tasks.GZipFiles.__init__ (   self,
  dataset,
  user,
  options 
)

Definition at line 171 of file production_tasks.py.

171  def __init__(self, dataset, user, options):
172  Task.__init__(self,'GZipFiles', dataset, user, options)
def __init__(self, dataset, user, options)

Member Function Documentation

def production_tasks.GZipFiles.gzip (   self,
  fileName 
)

Definition at line 173 of file production_tasks.py.

Referenced by production_tasks.GZipFiles.run().

173  def gzip(self, fileName):
174  output = '%s.gz' % fileName
175 
176  f_in = open(fileName, 'rb')
177  f_out = gzip.open(output, 'wb')
178  f_out.writelines(f_in)
179  f_out.close()
180  f_in.close()
181  #remove the original file once we've gzipped it
182  os.remove(fileName)
183  return output
184 
def gzip(self, fileName)
def production_tasks.GZipFiles.run (   self,
  input 
)

Definition at line 185 of file production_tasks.py.

References production_tasks.GZipFiles.gzip().

185  def run(self, input):
186  files = input['FilesToCompress']['Files']
187 
188  compressed = []
189  for f in files:
190  if f is None or not f: continue
191  if os.path.exists(f):
192  gz = self.gzip(f)
193  compressed.append(gz)
194  return {'CompressedFiles':compressed}
def gzip(self, fileName)