mirror of https://gitlab.com/pamhyr/pamhyr2
solver: Add abstract solver class.
parent
1d0f0723d1
commit
c4373fa00a
|
|
@ -0,0 +1,40 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from enum import Enum
|
||||
|
||||
class STATUS(Enum):
|
||||
STOPED = 0
|
||||
RUNNING = 1
|
||||
FAILED = 2
|
||||
CONF_ERROR = 3
|
||||
|
||||
class AbstractSolver(object):
|
||||
def __init__(self, name):
|
||||
super(AbstractSolver, self).__init__()
|
||||
|
||||
self.name = name
|
||||
self.status = STATUS.STOPED
|
||||
|
||||
def nb_proc(self):
|
||||
"""
|
||||
Return the number of processor used by solver (usefull for
|
||||
multiple solver run on same time).
|
||||
"""
|
||||
return 1
|
||||
|
||||
def status(self):
|
||||
return self.status
|
||||
|
||||
def set_status(self, status):
|
||||
self.status = status
|
||||
|
||||
def run(self):
|
||||
return False
|
||||
|
||||
def kill(self):
|
||||
return False
|
||||
|
||||
def readline(self):
|
||||
return ""
|
||||
Loading…
Reference in New Issue