1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.ServiceModel;
|
---|
6 | using System.IO;
|
---|
7 | using HeuristicLab.Services.Hive.Common.DataTransfer;
|
---|
8 | using System.Net.Security;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.Services.Hive.Common.ServiceContracts {
|
---|
11 |
|
---|
12 | [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
|
---|
13 | public interface IHiveService {
|
---|
14 |
|
---|
15 | #region Job Methods
|
---|
16 | [OperationContract]
|
---|
17 | Guid AddJob(Job job, JobData jobData);
|
---|
18 |
|
---|
19 | [OperationContract]
|
---|
20 | Guid AddChildJob(Guid parentJobId, Job job, JobData jobData);
|
---|
21 |
|
---|
22 | [OperationContract] // formerly GetJobById
|
---|
23 | Job GetJob(Guid jobId);
|
---|
24 |
|
---|
25 | [OperationContract] // formerly GetAllJobs
|
---|
26 | IEnumerable<Job> GetJobs();
|
---|
27 |
|
---|
28 | [OperationContract] // formerly GetJobResults
|
---|
29 | IEnumerable<LightweightJob> GetLightweightJobs(IEnumerable<Guid> jobIds);
|
---|
30 |
|
---|
31 | [OperationContract] // formerly GetChildJobResults
|
---|
32 | IEnumerable<LightweightJob> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent);
|
---|
33 |
|
---|
34 | [OperationContract] // formerly GetLastSerializedResult
|
---|
35 | JobData GetJobData(Guid jobId);
|
---|
36 |
|
---|
37 | //[OperationContract]
|
---|
38 | //Stream GetJobDataStreamed(Guid jobId);
|
---|
39 |
|
---|
40 | [OperationContract]
|
---|
41 | void UpdateJob(Job jobDto, JobData jobDataDto);
|
---|
42 |
|
---|
43 | //[OperationContract] // formerly StoreFinishedJobResultStreamed
|
---|
44 | //void UpdateJobDataStreamed(Stream stream);
|
---|
45 |
|
---|
46 | [OperationContract]
|
---|
47 | void DeleteChildJobs(Guid parentJobId);
|
---|
48 |
|
---|
49 | [OperationContract] // new method: appropriate job is choosen and set to 'calculating'. the slave is responsible for requesting the jobData. Server should wait some timeout until he redistributes the job
|
---|
50 | Job AquireJob(Guid slaveId);
|
---|
51 |
|
---|
52 | //[OperationContract] // dump?
|
---|
53 | //Job GetJobByIdWithDetails(Guid jobId);
|
---|
54 |
|
---|
55 | //[OperationContract] dump?
|
---|
56 | //Job AddNewJob(JobData job);
|
---|
57 |
|
---|
58 | //[OperationContract]
|
---|
59 | //void RemoveJob(Guid jobId);
|
---|
60 |
|
---|
61 | //[OperationContract] // GetJobForCalculation (was this used?
|
---|
62 | //Job GetJob(Guid slaveId);
|
---|
63 |
|
---|
64 | //[OperationContract] --> replaced by UpdateJob
|
---|
65 | //void StoreFinishedJobResult(Guid slaveId, Guid jobId, byte[] result, TimeSpan executionTime, string exception);
|
---|
66 |
|
---|
67 | //[OperationContract] dump this! a slave should just check if job is still offline, if so it can submit the finished job, otherwise throw away! its a rare case that a slave reawakes with a finished job
|
---|
68 | //void IsJobStillNeeded(Guid jobId);
|
---|
69 |
|
---|
70 | //[OperationContract] // dump?
|
---|
71 | //Job AddJobWithGroupStrings(JobData jobObj, IEnumerable<string> groups);
|
---|
72 | #endregion
|
---|
73 |
|
---|
74 | #region Job Control Methods
|
---|
75 | [OperationContract]
|
---|
76 | void StopJob(Guid jobId);
|
---|
77 |
|
---|
78 | [OperationContract]
|
---|
79 | Job PauseJob(Guid jobId);
|
---|
80 | #endregion
|
---|
81 |
|
---|
82 | #region HiveExperiment Methods
|
---|
83 | [OperationContract]
|
---|
84 | HiveExperiment GetHiveExperiment(Guid id);
|
---|
85 |
|
---|
86 | /// <summary>
|
---|
87 | /// Returns all experiments for the current user
|
---|
88 | /// </summary>
|
---|
89 | [OperationContract]
|
---|
90 | IEnumerable<HiveExperiment> GetHiveExperiments();
|
---|
91 |
|
---|
92 | [OperationContract]
|
---|
93 | Guid AddHiveExperiment(HiveExperiment hiveExperimentDto);
|
---|
94 |
|
---|
95 | [OperationContract]
|
---|
96 | void UpdateHiveExperiment(HiveExperiment hiveExperimentDto);
|
---|
97 |
|
---|
98 | [OperationContract]
|
---|
99 | void DeleteHiveExperiment(Guid hiveExperimentId);
|
---|
100 | #endregion
|
---|
101 |
|
---|
102 | #region Login Methods
|
---|
103 | // rename "Login"-methods to "Register" or "SayHello", since its only purpose is to send Slave-Info (is Login() should not be used anymore)
|
---|
104 | /// <summary>
|
---|
105 | /// Method can be used to check if security credentials are valid, but it does not do anything
|
---|
106 | /// </summary>
|
---|
107 | /// <returns></returns>
|
---|
108 | //[OperationContract]
|
---|
109 | //void Login();
|
---|
110 | ///// <summary>
|
---|
111 | ///// This method registers the slave and marks it as online
|
---|
112 | ///// </summary>
|
---|
113 | //[OperationContract]
|
---|
114 | //void Login(Slave slave);
|
---|
115 | //[OperationContract]
|
---|
116 | //void Logout(Guid clientId);
|
---|
117 |
|
---|
118 | [OperationContract]
|
---|
119 | void Hello(Guid slaveId, string name, int cores, int memory);
|
---|
120 |
|
---|
121 | [OperationContract]
|
---|
122 | void GoodBye();
|
---|
123 | #endregion
|
---|
124 |
|
---|
125 | #region Heartbeat Methods
|
---|
126 | [OperationContract]
|
---|
127 | List<MessageContainer> Heartbeat(Heartbeat heartbeat);
|
---|
128 | #endregion
|
---|
129 |
|
---|
130 | #region Plugin Methods
|
---|
131 | [OperationContract]
|
---|
132 | Guid AddPlugin(Plugin plugin, List<PluginData> pluginData);
|
---|
133 | [OperationContract]
|
---|
134 | IEnumerable<Plugin> GetPlugins();
|
---|
135 | [OperationContract]
|
---|
136 | IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds);
|
---|
137 | #endregion
|
---|
138 |
|
---|
139 | // slave should be unaware of calendar. only server decides based on calendar if slave gets jobs
|
---|
140 | //#region Calendar Methods
|
---|
141 | //[OperationContract]
|
---|
142 | //IEnumerable<Appointment> GetCalendar(Guid slaveId);
|
---|
143 | //[OperationContract]
|
---|
144 | //void SetCalendarStatus(Guid clientId, CalendarState state);
|
---|
145 | //[OperationContract]
|
---|
146 | //IEnumerable<Appointment> GetUptimeCalendarForResource(Guid guid);
|
---|
147 | //[OperationContract]
|
---|
148 | //void SetUptimeCalendarForResource(Guid guid, IEnumerable<Appointment> appointments, bool isForced);
|
---|
149 | //#endregion
|
---|
150 |
|
---|
151 | #region Slave Methods
|
---|
152 | [OperationContract]
|
---|
153 | Guid AddSlave(Slave slave);
|
---|
154 |
|
---|
155 | [OperationContract]
|
---|
156 | Guid AddSlaveGroup(SlaveGroup slaveGroup);
|
---|
157 |
|
---|
158 | [OperationContract]
|
---|
159 | IEnumerable<Slave> GetSlaves();
|
---|
160 |
|
---|
161 | [OperationContract]
|
---|
162 | //[ServiceKnownType(typeof(Resource))] - not sure about those
|
---|
163 | //[ServiceKnownType(typeof(Slave))]
|
---|
164 | //[ServiceKnownType(typeof(SlaveGroup))]
|
---|
165 | IEnumerable<SlaveGroup> GetSlaveGroups();
|
---|
166 |
|
---|
167 | [OperationContract]
|
---|
168 | void DeleteSlaveGroup(Guid clientGroupId);
|
---|
169 |
|
---|
170 | [OperationContract]
|
---|
171 | //[ServiceKnownType(typeof(Resource))]
|
---|
172 | //[ServiceKnownType(typeof(Slave))]
|
---|
173 | //[ServiceKnownType(typeof(SlaveGroup))]
|
---|
174 | void AddResourceToGroup(Guid slaveGroupId, Resource resource);
|
---|
175 |
|
---|
176 | [OperationContract]
|
---|
177 | void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId);
|
---|
178 |
|
---|
179 | [OperationContract]
|
---|
180 | void UpdateSlave(Slave slave);
|
---|
181 | #endregion
|
---|
182 |
|
---|
183 | }
|
---|
184 | }
|
---|