qcg.pilotjob.fileinterface module
- class qcg.pilotjob.fileinterface.FileInterface
Bases:
objectInterface 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
receivemethod.- 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.
- async 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.
- async 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.