qcg.pilotjob.fileinterface module

class qcg.pilotjob.fileinterface.FileInterface

Bases: object

Interface for reading requests from file.

cnt

number of received requests so far

Type:int
path

path to the file from whom requests will be read

Type:str
classmethod name()

Return interface’ name.

Returns:name of the interface
Return type:str
setup(conf)

Setup interface.

Open file and read all requests in JSON format. The loaded requests are returned in receive method.

Parameters:

conf – the QCG-PilotJob configuration

Raises:
  • JobFileNotExists – when file doens’t exist
  • IllegalJobDescription – when file doesn’t contain the JSON format or the file doesn’t contain the list.
close()

Close interface.

receive()

Return next request.

This method contains the artificial sleep, to get chance of other events in QCG-PilotJob to process. There could be a chance, that no job has been processed until all requests from file has been read.

Returns: the next request or None if no more request is available.

reply(reply_msg)

Reply response to the other part of this interface.

Parameters:reply_msg (str) – message to sent as reply

Because file interface is used in batch mode, the response is ignored.