-
Notifications
You must be signed in to change notification settings - Fork 21
/
resmgr.go
84 lines (78 loc) · 2.59 KB
/
resmgr.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package core
import (
"github.com/MG-RAST/AWE/lib/user"
)
type ClientMgr interface {
RegisterNewClient(FormFiles, *ClientGroup) (*Client, error)
ClientHeartBeat(string, *ClientGroup, WorkerState) (HeartbeatInstructions, error)
GetClient(string, bool) (*Client, bool, error)
GetClientByUser(string, *user.User) (*Client, error)
//GetAllClients() []*Client
GetClientMap() *ClientMap
GetAllClientsByUser(*user.User) ([]*Client, error)
//DeleteClient(*Client) error
//DeleteClientById(string) error
//DeleteClientByUser(string, *user.User) error
SuspendClient(string, *Client, string, bool) error
SuspendClientByUser(string, *user.User, string) error
ResumeClient(string) error
ResumeClientByUser(string, *user.User) error
ResumeSuspendedClients() (int, error)
ResumeSuspendedClientsByUser(*user.User) int
SuspendAllClients(string) (int, error)
SuspendAllClientsByUser(*user.User, string) (int, error)
ClientChecker()
UpdateSubClients(string, int) error
UpdateSubClientsByUser(string, int, *user.User)
}
type WorkMgr interface {
GetWorkById(Workunit_Unique_Identifier) (*Workunit, error)
ShowWorkunits(string) ([]*Workunit, error)
ShowWorkunitsByUser(string, *user.User) []*Workunit
CheckoutWorkunits(string, string, *Client, int64, int) ([]*Workunit, error)
NotifyWorkStatus(Notice)
EnqueueWorkunit(*Workunit) error
FetchDataToken(Workunit_Unique_Identifier, string) (string, error)
FetchPrivateEnv(Workunit_Unique_Identifier, string) (map[string]string, error)
}
type JobMgr interface {
EnqueueTasksByJobId(string, string) error
GetActiveJobs() map[string]bool
IsJobRegistered(string) bool
GetSuspendJobs() map[string]bool
SuspendJob(string, *JobError) error
ResumeSuspendedJobByUser(string, *user.User) error
ResumeSuspendedJobsByUser(*user.User) int
ResubmitJob(string) error
DeleteJobByUser(string, *user.User, bool) error
DeleteSuspendedJobsByUser(*user.User, bool) int
DeleteZombieJobsByUser(*user.User, bool) int
RecoverJob(string, *Job) (bool, error)
RecoverJobs() (int, int, error)
FinalizeWorkPerf(Workunit_Unique_Identifier, string) error
SaveStdLog(Workunit_Unique_Identifier, string, string) error
GetReportMsg(Workunit_Unique_Identifier, string) (string, error)
RecomputeJob(string, string) error
UpdateQueueToken(*Job) error
}
type ClientWorkMgr interface {
ClientMgr
WorkMgr
}
type ResourceMgr interface {
ClientWorkMgr
JobMgr
ClientHandle()
UpdateQueueLoop()
NoticeHandle()
GetJsonStatus() (map[string]map[string]int, error)
GetTextStatus() string
QueueStatus() string
GetQueue(string) interface{}
SuspendQueue()
ResumeQueue()
Lock()
Unlock()
RLock()
RUnlock()
}