17.1.1.2. AcquisitionBatchStep

class acquisition.AcquisitionBatchStep[source]

Bases: acquisition.AcquisitionStep

Abstract class to describe a batch acquisition step.

You have to override this class.

Variables:_batch (AcquisitionBatch) – AcquisitionBatch object.

Attributes Summary

batch_process_max_size Return the max size of a batch in batch process mode.
batch_process_max_wait Max wait (in seconds) to fill the batch in batch process mode.

Methods Summary

batch_process(xafs) Process a batch of files.
process(xaf) Process one file.

Attributes Documentation

batch_process_max_size

Return the max size of a batch in batch process mode.

If not overriden, the default value is 100.

batch_process_max_wait

Max wait (in seconds) to fill the batch in batch process mode.

If not overriden, the default value is 10 (so 10 seconds).

Methods Documentation

batch_process(xafs)[source]

Process a batch of files.

Process several XattrFile (between 1 and max_batch_size files in one call). You have to override this method.

File are moved into a temporary directory before the call with unique filenames. Extended attributes are copied to them. So you can do what you want with them.

If the method returns True: - we considerer that the processing is ok - all files are deleted if necessary

If the method returns False: - we considerer that the result is False for each file - so each file follow the failure policy

If the method returns an array of booleans (of the same size than the xafs array), we consider that the processing status for each file.

Parameters:xafs (list) – XattrFile objects (list of files to process).
Returns:Processing status (True, False or array of booleans).
process(xaf)[source]

Process one file.

Process one XattrFile. You have to override this method (unless your class inherits from BatchStep, see batch_process() in that case).

The file is moved into a temporary directory before the call with an unique filename. Extended attributes are copied to it. So you can do what you want with it.

If the method returns True:

  • we considerer that the processing is ok
  • the file is delete if necessary

If the method doesn’t return True:

  • we considerer that the processing is not ok (a warning message is
    logged).
  • the file is given to the choosen failure policy.
Parameters:xaf – XattrFile object.
Returns:processing status (True: ok, False: not ok)
Return type:boolean