Skip to content

Commit 17c3bd3

Browse files
author
francois branciard
committed
consensus reach (and Gilles approved too ) : TaskRequest rename to WorkOrder
1 parent c94d9cc commit 17c3bd3

30 files changed

+689
-669
lines changed

README.md

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33

44

55

6-
76
# Actors :
87
- (w) = an account with a wallet key pair
98
- (s) = a smart contract created by (w)
109
- (p) = application to start ( like java prog) on the responsability of (w) when used
1110
- (r) = a repository on the responsability of (w)
1211

13-
## Marketplace Creator :
14-
create [IexecHub](./contracts/IexecHub.sol) smart contract. IexecHub is composed of [TaskRequestHub](./contracts/TaskRequestHub.sol),[WorkerPoolHub](./contracts/WorkerPoolHub.sol),[DatasetHub](./contracts/DatasetHub.sol),[AppHub](./contracts/AppHub.sol). Once smart contract are created, Marketplace can be used by the following actors :
12+
## Actor : Marketplace Creator :
13+
create [IexecHub](./contracts/IexecHub.sol) smart contract. IexecHub is composed of [WorkOrderHub](./contracts/WorkOrderHub.sol),[WorkerPoolHub](./contracts/WorkerPoolHub.sol),[DatasetHub](./contracts/DatasetHub.sol),[AppHub](./contracts/AppHub.sol). Once IexecHub smart contract is created by Marketplace Creator, Marketplace can be used by the others actors scheduler, workers, iExecCloudUser :
1514

1615
blockchain interaction :
1716
<table>
@@ -39,15 +38,41 @@ blockchain interaction :
3938
</tbody>
4039
</table>
4140

41+
## Actor : iExecCloudUser
42+
- iExecCloudUser = U(w)
43+
- U(s) = a [WorkOrder](./contracts/WorkOrder.sol) smart contract owned by U(w)
4244

45+
WorkOrder status are :
46+
- PENDING : workOrder not yet accepted by the scheduler of workerPool
47+
- ACCEPTED : accepted by the scheduler of workerPool
48+
- CANCELLED : a non accepted work order have been cancelled by the user U(w)
49+
- ABORTED : an accepted work order has never reach the consensus and claimFailedConsensus has been called. The status is set to ABORTED
50+
- COMPLETED : worker order is COMPLETED. finalizedWork function has been successfully called in the Workpool smart contract.
4351

4452

45-
46-
## Scheduler :
53+
## Actor : Scheduler :
4754
- ScheduleProvider = S(w)
4855
- S(s) = a [WorkerPool](./contracts/WorkerPool.sol) smart contract owned by S(w)
4956
- S(p) = iexec-scheduler = application that schedule a worker pool activity on the responsability of S(w). (works, tasks, datas for result in xtremweb)
50-
- S(r) = ResultRepository = provide the task result for U(w) on the responsability of S(w)
57+
- S(r) = ResultRepository = provide the work result for U(w) on the responsability of S(w)
58+
59+
Each WorkOrder affected in this WorkPool have a ConsensusStatus :
60+
- PENDING : scheduler have not accepted the work order yet. (WorkOrder=PENDING)
61+
- CANCELLED : a non accepted work order have been cancelled by the user U(w) (WorkOrder=CANCELLED)
62+
- STARTED : scheduler has called acceptWorkOrder function.(WorkOrder=ACCEPTED)
63+
- IN_PROGRESS : scheduler has called at least on callForContribution (WorkOrder=ACCEPTED)
64+
- REACHED :scheduler has called at revealConsensus function (WorkOrder=ACCEPTED)
65+
- FAILLED : claimFailedConsensus has been called. (WorkOrder=ABORTED)
66+
- FINALIZED :finalizedWork has been successfully called (WorkOrder=COMPLETED)
67+
68+
69+
Each worker Contribution of an accepted WorkOrder has a WorkStatus :
70+
- REQUESTED : this worker has callForContribution by the scheduler
71+
- SUBMITTED : this worker has contribute
72+
- POCO_ACCEPT : this worker has reveal and is contribute is valid
73+
- REJECTED : this worker has reveal and is contribute is not valid
74+
75+
5176

5277
blockchain interaction :
5378

@@ -72,8 +97,8 @@ blockchain interaction :
7297
<td><a href="./contracts/WorkerPool.sol" target="_blank">WorkerPool</a></td>
7398
</tr>
7499
<tr>
75-
<td><a href="./test/5_taskRequestAccepted.js" target="_blank">5_taskRequestAccepted.js</a></td>
76-
<td>acceptTask</td>
100+
<td><a href="./test/5_workOrderAccepted.js" target="_blank">5_workOrderAccepted.js</a></td>
101+
<td>acceptWorkOrder</td>
77102
<td>WorkerPool</td>
78103
<td>ScheduleProvider</td>
79104
<td>iexec-scheduler</td>
@@ -96,8 +121,8 @@ blockchain interaction :
96121
<td></td>
97122
</tr>
98123
<tr>
99-
<td><a href="./test/10_finalizedTask.js" target="_blank">10_finalizedTask.js</a></td>
100-
<td>finalizedTask</td>
124+
<td><a href="./test/10_finalizedWork.js" target="_blank">10_finalizedWork.js</a></td>
125+
<td>finalizedWork</td>
101126
<td>WorkerPool</td>
102127
<td>ScheduleProvider</td>
103128
<td>iexec-scheduler</td>
@@ -108,7 +133,7 @@ blockchain interaction :
108133

109134

110135

111-
## Worker :
136+
## Actor : Worker :
112137
- W(w) = RessourceProvider = RessourceProvider wallet
113138
- W(p) = iexec-worker = xtremweb worker application today
114139

@@ -150,7 +175,7 @@ blockchain interaction :
150175

151176

152177

153-
## App Provider
178+
## Actor : App Provider
154179
- A(w) = AppProvider = app Provider wallet
155180
- A(s) = [App](./contracts/App.sol) = app smart contract created by A(w) with the app characteristics
156181
- A(r) = AppRepository = provide app reference on the responsability of A(w). . (apps, datas for apps in xtremweb, docker hub for docker app etc ... ) for W(p) usage
@@ -181,7 +206,7 @@ blockchain interaction :
181206
</tbody>
182207
</table>
183208

184-
## Dataset Provider
209+
## Actor : Dataset Provider
185210
- D(w) = DatasetProvider = dataset Provider wallet
186211
- D(s) = [Dataset](./contracts/Dataset.sol) = app smart contract created by D(w) with the dataset characteristics
187212
- D(r) = DatasetRepository = provide dataset reference on the responsability of D(w) for W(p) usage
@@ -235,16 +260,16 @@ TODO
235260
</tr>
236261
<tr>
237262
<td><a href="./uml/V2SequenceNominale.pdf" target="_blank">transaction 4</a></td>
238-
<td><a href="./test/4_taskRequestCreation.js" target="_blank">4_taskRequestCreation.js</a></td>
239-
<td>createTaskRequest</td>
263+
<td><a href="./test/4_workOrderCreation.js" target="_blank">4_workOrderCreation.js</a></td>
264+
<td>createWorkOrder</td>
240265
<td>IexecHub</td>
241266
<td>iExecCloudUser (iexec-sdk)</td>
242-
<td><a href="./contracts/TaskRequest.sol" target="_blank">TaskRequest</a></td>
267+
<td><a href="./contracts/WorkOrder.sol" target="_blank">WorkOrder</a></td>
243268
</tr>
244269
<tr>
245270
<td><a href="./uml/V2SequenceNominale.pdf" target="_blank">transaction 5</a></td>
246-
<td><a href="./test/5_taskRequestAccepted.js" target="_blank">5_taskRequestAccepted.js</a></td>
247-
<td>acceptTask</td>
271+
<td><a href="./test/5_workOrderAccepted.js" target="_blank">5_workOrderAccepted.js</a></td>
272+
<td>acceptWorkOrder</td>
248273
<td>WorkerPool</td>
249274
<td>iexec-scheduler</td>
250275
<td></td>
@@ -283,8 +308,8 @@ TODO
283308
</tr>
284309
<tr>
285310
<td><a href="./uml/V2SequenceNominale.pdf" target="_blank">transaction 10</a></td>
286-
<td><a href="./test/10_finalizedTask.js" target="_blank">10_finalizedTask.js</a></td>
287-
<td>finalizedTask</td>
311+
<td><a href="./test/10_finalizedWork.js" target="_blank">10_finalizedWork.js</a></td>
312+
<td>finalizedWork</td>
288313
<td>WorkerPool</td>
289314
<td>iexec-scheduler</td>
290315
<td></td>

contracts/IexecAPI.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ contract IexecAPI
77

88
address private iexecHubAddress;
99
IexecHub private iexecHub;
10-
event TaskRequestCallback(address taskId, string stdout, string stderr, string uri);
10+
event WorkOrderCallback(address woid, string stdout, string stderr, string uri);
1111

1212
// Constructor
1313
function IexecAPI(address _iexecHubAddress) public
@@ -20,27 +20,27 @@ contract IexecAPI
2020
address _workerPool,
2121
address _app,
2222
address _dataset,
23-
string _taskParam,
24-
uint _taskCost,
23+
string _workOrderParam,
24+
uint _workReward,
2525
uint _askedTrust,
2626
bool _dappCallback,
2727
address _beneficiary)
2828
public
2929
{
30-
iexecHub.createTaskRequest(_workerPool, _app, _dataset, _taskParam, _taskCost, _askedTrust, _dappCallback,_beneficiary);
30+
iexecHub.createWorkOrder(_workerPool, _app, _dataset, _workOrderParam, _workReward, _askedTrust, _dappCallback,_beneficiary);
3131
}
3232

3333
// TODO add cancel Task function
3434

35-
function taskRequestCallback(
36-
address _taskId,
35+
function workOrderCallback(
36+
address _woid,
3737
string _stdout,
3838
string _stderr,
3939
string _uri)
4040
public returns (bool)
4141
{
42-
require(msg.sender == _taskId);
43-
TaskRequestCallback(_taskId, _stdout, _stderr, _uri);
42+
require(msg.sender == _woid);
43+
WorkOrderCallback(_woid, _stdout, _stderr, _uri);
4444
return true;
4545
}
4646
}

0 commit comments

Comments
 (0)