Commit 6eaf46e1 authored by Bas Lijnse's avatar Bas Lijnse

Temporary fix for non-updating shares. Now it recomputes all task instances that depend on a share.

Still to do: make a smarter filter to exclude those of which we are sure that they don't need recomputation.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@2374 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent c1333ba1
......@@ -11,7 +11,9 @@ from IWorld import :: IWorld(..)
from iTasks import JSONEncode, JSONDecode, dynamicJSONEncode, dynamicJSONDecode
from TaskEval import localShare, parListShare, topListShare
from CoreTasks import return
from SharedDataSource import writeFilterMsg, read
from SharedDataSource import write, writeFilterMsg, read
WORKON_EXPIRY :== 5000 //NO REAL SOLUTION...
derive class iTask ParallelTaskType, WorkOnStatus
......@@ -55,7 +57,8 @@ where
= case er of
Ok r = case projection val r of
Just w
# (ew, iworld) = writeFilterMsg w ((<>) currentInstance) share iworld
//# (ew, iworld) = writeFilterMsg w ((<>) currentInstance) share iworld
# (ew, iworld) = write w share iworld
= case ew of
Ok _ = (result, iworld)
Error e = (exception e, iworld)
......@@ -465,16 +468,16 @@ where
# layout = repLayout repOpts
= case (meta,result,rep) of
(_,Ok (TIValue (Value _ True) _),_)
= (ValueResult (Value WOFinished True) {TaskInfo|lastEvent=ts,expiresIn=Nothing} (finalizeRep repOpts noRep) tree, iworld)
= (ValueResult (Value WOFinished True) {TaskInfo|lastEvent=ts,expiresIn=Just WORKON_EXPIRY} (finalizeRep repOpts noRep) tree, iworld)
(_,Ok (TIException _ _),_)
= (ValueResult (Value WOExcepted True) {TaskInfo|lastEvent=ts,expiresIn=Nothing} (finalizeRep repOpts noRep) tree, iworld)
= (ValueResult (Value WOExcepted True) {TaskInfo|lastEvent=ts,expiresIn=Just WORKON_EXPIRY} (finalizeRep repOpts noRep) tree, iworld)
(Ok meta=:{TIMeta|worker=Just worker},_,Ok (TaskRep def parts))
| worker == currentUser
# rep = finalizeRep repOpts (TaskRep (layout.Layout.workOn def meta) parts)
= (ValueResult (Value WOActive False) {TaskInfo|lastEvent=ts,expiresIn=Nothing} rep tree, iworld)
= (ValueResult (Value WOActive False) {TaskInfo|lastEvent=ts,expiresIn=Just WORKON_EXPIRY} rep tree, iworld)
| otherwise
# rep = finalizeRep repOpts (TaskRep (layout.Layout.workOn (inUseDef worker) meta) parts)
= (ValueResult (Value (WOInUse worker) False) {TaskInfo|lastEvent=ts,expiresIn=Nothing} rep tree, iworld)
= (ValueResult (Value (WOInUse worker) False) {TaskInfo|lastEvent=ts,expiresIn=Just WORKON_EXPIRY} rep tree, iworld)
_
= (ValueResult (Value WODeleted True) {TaskInfo|lastEvent=ts,expiresIn=Nothing} (finalizeRep repOpts noRep) tree, iworld)
......
......@@ -3,7 +3,7 @@ implementation module CoreTasks
import StdList, StdBool, StdInt, StdTuple,StdMisc, Util, HtmlUtil, Time, Error, OSError, Map, Tuple, List_NG
import qualified StdList
import iTaskClass, Task, TaskState, TaskEval, TaskStore, UIDefinition, LayoutCombinators, Shared
from SharedDataSource import qualified read, readRegister, writeFilterMsg
from SharedDataSource import qualified read, readRegister, write, writeFilterMsg
from StdFunc import o, id
from IWorld import :: IWorld(..)
from SystemData import topLevelTasks
......@@ -33,7 +33,8 @@ set :: !a !(ReadWriteShared r a) -> Task a | iTask a
set val shared = mkInstantTask eval
where
eval taskId iworld=:{taskTime,currentInstance}
# (res,iworld) ='SharedDataSource'.writeFilterMsg val ((<>) currentInstance) shared iworld
//# (res,iworld) ='SharedDataSource'.writeFilterMsg val ((<>) currentInstance) shared iworld
# (res,iworld) ='SharedDataSource'.write val shared iworld
= case res of
Ok _ = (Ok val,iworld)
Error e = (Error (dynamic (SharedException e), e), iworld)
......@@ -47,7 +48,8 @@ where
Error e = (Error (dynamic (SharedException e), e), iworld)
Ok r
# w = fun r
# (er, iworld) = 'SharedDataSource'.writeFilterMsg w ((<>) currentInstance) shared iworld
//# (er, iworld) = 'SharedDataSource'.writeFilterMsg w ((<>) currentInstance) shared iworld
# (er, iworld) = 'SharedDataSource'.write w shared iworld
= case er of
Ok _ = (Ok w, iworld)
Error e = (Error (dynamic (SharedException e), e), iworld)
......
definition module IWorld
from FilePath import :: FilePath
from Void import :: Void
from Map import :: Map
from Maybe import :: Maybe
from SystemTypes import :: DateTime, :: User, :: Config, :: InstanceNo, :: TaskNo, :: TaskId, :: TaskListItem, :: ParallelTaskType, :: TaskTime, :: SessionId
......@@ -49,6 +50,7 @@ instance FileSystem IWorld
instance registerSDSDependency InstanceNo IWorld
instance registerSDSChangeDetection IWorld
instance reportSDSChange InstanceNo IWorld
instance reportSDSChange Void IWorld
//Sync work queue to disk (Only used with CGI wrapper)
saveWorkQueue :: !*IWorld -> *IWorld
......
......@@ -100,6 +100,12 @@ where
reportSDSChange shareId filterFun iworld
= addOutdatedOnShareChange shareId filterFun iworld
instance reportSDSChange Void IWorld
where
reportSDSChange shareId _ iworld
= addOutdatedOnShareChange shareId (\_ -> True) iworld
// serialise Work as dynamic since it contains functions on unique states
JSONEncode{|Work|} work = [JSONArray [JSONString "_FUNCTION_", JSONString (base64URLEncode (serialize work))]]
JSONDecode{|Work|} [JSONArray [JSONString "_FUNCTION_",JSONString string]:c] = (Just (fromOk(deserialize {s` \\ s` <-: base64URLDecode string})) ,c)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment