Commit 922c1885 authored by Bas Lijnse's avatar Bas Lijnse

removed newProcesses administration, it is no longer necessary.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@675 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 25cf1533
......@@ -29,9 +29,8 @@ import GenPrint, GenParse, GenVisualize, GenUpdate
, activated :: !Bool // if true activate task, if set as result task completed
, mainTask :: !ProcessId // The id of the current main task
, newProcesses :: ![ProcessId] // A list of spawned processes for the current user
, options :: !Options // iData lifespan and storage format
, options :: !Options // options
, staticInfo :: !StaticInfo // info which does not change during a run
, exception :: !Maybe Dynamic // Optional, used when raising exceptions
......@@ -148,34 +147,6 @@ getWorkflows :: !*TSt -> (![Workflow],!*TSt)
*/
getWorkflowByName :: !String !*TSt -> (!Maybe Workflow, !*TSt)
/**
* Adds the id of a newly created process to the list
* in the task state, such that it can be executed later on.
*
* @param The id of the newly created process
* @param The task state
*
* @return The modified task state
*/
addNewProcess :: !ProcessId !*TSt -> *TSt
/**
* Get the list of newly created processes
*
* @param The task state
*
* @return The list of new process ids
* @return The modified task state
*/
getNewProcesses :: !*TSt -> (![ProcessId], !*TSt)
/**
* Clears the list of newly created processes
*
* @param The task state
*
* @return The modified task state
*/
clearNewProcesses :: !*TSt -> *TSt
/**
* Apply a function on World on a TSt
*/
......
......@@ -40,7 +40,6 @@ mkTSt appName config request session workflows systemStore dataStore world
, tree = TTMainTask initTaskInfo initTaskProperties []
, activated = True
, mainTask = ""
, newProcesses = []
, options = initialOptions
, staticInfo = initStaticInfo appName session workflows
, exception = Nothing
......@@ -123,7 +122,6 @@ calculateTaskForest enableDebug tst
# (currentUser,tst) = getCurrentUser tst
# (processes,tst) = getProcessesForUser currentUser [Active] tst //Lookup all active processes for this user
# (trees,tst) = calculateTrees (sortProcesses processes) tst
# (trees,tst) = addNewProcesses (reverse trees) tst
= (Nothing, trees, tst)
//Needed for RPC Daemon
......@@ -131,20 +129,11 @@ calculateCompleteTaskForest :: !Bool !*TSt -> (Maybe String, ![TaskTree], !*TSt)
calculateCompleteTaskForest enableDebug tst
# (processes, tst) = getProcesses [Active,Suspended] tst
# (trees, tst) = calculateTrees processes tst
# (trees, tst) = addNewProcesses trees tst
= (Nothing, trees, tst)
sortProcesses :: ![Process] -> [Process]
sortProcesses ps = sortBy (\p1 p2 -> p1.Process.processId > p2.Process.processId) ps
addNewProcesses :: ![TaskTree] *TSt -> (![TaskTree],!*TSt)
addNewProcesses trees tst
# (pids,tst) = getNewProcesses tst
| isEmpty pids = (trees,tst) //Nothing to do...
# (processes,tst) = getProcessesById pids tst //Lookup the process entries
# tst = clearNewProcesses tst //Reset the list of new processes
# (ntrees,tst) = calculateTrees (sortProcesses processes) tst //Calculate the additional task trees
= addNewProcesses (trees ++ reverse ntrees) tst //Recursively check for more new processes
calculateTrees :: ![Process] !*TSt -> (![TaskTree], !*TSt)
calculateTrees [] tst = ([],tst)
......@@ -257,13 +246,13 @@ evalDynamicResult d = code {
}
applyChangeToTaskTree :: !ProcessId !Dynamic !ChangeLifeTime !*TSt -> *TSt
applyChangeToTaskTree pid change lifetime tst=:{taskNr,taskInfo,firstRun,userId,delegatorId,tree,activated,mainTask,newProcesses,options,staticInfo,exception,doChange,changes}
applyChangeToTaskTree pid change lifetime tst=:{taskNr,taskInfo,firstRun,userId,delegatorId,tree,activated,mainTask,options,staticInfo,exception,doChange,changes}
# (mbProcess,tst) = getProcess pid tst
= case mbProcess of
(Just proc)
# tst = thd3 (buildProcessTree proc (Just (change,lifetime)) tst)
= {tst & taskNr = taskNr, taskInfo = taskInfo, firstRun = firstRun, userId = userId, delegatorId = delegatorId
, tree = tree, activated = activated, mainTask = mainTask, newProcesses = newProcesses, options = options
, tree = tree, activated = activated, mainTask = mainTask, options = options
, staticInfo = staticInfo, exception = exception, doChange = doChange, changes = changes}
Nothing
= tst
......@@ -294,15 +283,6 @@ getWorkflowByName name tst
[workflow] = (Just workflow, tst)
_ = (Nothing,tst)
addNewProcess :: !ProcessId !*TSt -> *TSt
addNewProcess pid tst = {tst & newProcesses = [pid:tst.newProcesses]}
getNewProcesses :: !*TSt -> (![ProcessId], !*TSt)
getNewProcesses tst =:{newProcesses} = (newProcesses, tst)
clearNewProcesses :: !*TSt -> *TSt
clearNewProcesses tst = {tst & newProcesses = []}
taskFinished :: !*TSt -> (!Bool, !*TSt)
taskFinished tst=:{activated} = (activated, {tst & activated = activated})
......
......@@ -34,11 +34,7 @@ where
# (curTime,tst) = accWorldTSt time tst
# (newPid,tst) = ProcessDB@createProcess (entry mainTask curTime (user.User.userId,user.User.displayName) (delegator.User.userId,delegator.User.displayName)) tst
# tst = storeTaskThread (taskNrFromString newPid) (createTaskThread task) tst
| uid == curUid
# tst = addNewProcess newPid tst
= (ProcessReference newPid, {tst & activated = True})
| otherwise
= (ProcessReference newPid, {tst & activated = True})
= (ProcessReference newPid, {tst & activated = True})
entry pid now user delegator = mkProcessEntry (taskLabel task) now user delegator (if activate Active Suspended) pid // Create a process database entry
......
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