Commit 0a4fa906 authored by BIOPZ-Gypas Foivos's avatar BIOPZ-Gypas Foivos

Changed defaultMemory to defaultMemory

parent ef9d2e23
......@@ -16,7 +16,7 @@ import time
import logging
import datetime
from operator import itemgetter
import threading
import threading
import yaml
import shutil
import collections
......@@ -58,7 +58,7 @@ class CWLRestAPI(FlaskView):
route_base = '/' #flask_classful specific, class variable
def __init__(self):
self.baseDir = './workflows/' #for developing only
self.sharedStorage = "" #'./datasets/'
self.sharedStorage = './datasets/'
self.__wfManager = WorkflowManager()
############################################################
#Section: Routed Methods
......@@ -84,7 +84,7 @@ class CWLRestAPI(FlaskView):
wf = WorkflowWrapper(userToken = data["usertoken"], sharedStorage = self.sharedStorage+data["sharedStoragePath"], workflowName = data["workflowName"], baseDir = self.baseDir)
except IndexError:
raise RessourceError("The submitted Git repository does not follow expected conventions", status_code="406")
self.__wfManager.addWorkflow(wf)
return json.dumps(self.__wfManager.startWorkflow(wf.workflowName))
......@@ -185,16 +185,16 @@ class WorkflowManager:
"""
def __init__(self, workflowList=[]):
self.workflowList = workflowList
def addWorkflow(self, wf):
"""
This method recieves the incoming workflow from the API and saves the WorkflowWrapper object.
This method recieves the incoming workflow from the API and saves the WorkflowWrapper object.
"""
self.workflowList.append(wf)
def startWorkflow(self, wfName):
"""
This method recieves the incoming workflow from the API and starts it in a thread.
This method recieves the incoming workflow from the API and starts it in a thread.
"""
wf = None
......@@ -202,7 +202,7 @@ class WorkflowManager:
if i.workflowName == wfName:
wf = i
break
wf.start()
while not wf.workflowID:
......@@ -256,8 +256,8 @@ class WorkflowManager:
def getWorkflowInfoByID(self, id):
"""
A detailed description about the status of the Workflow with the
given ID is retrieved here and returned to the frontend.
A detailed description about the status of the Workflow with the
given ID is retrieved here and returned to the frontend.
This method is responsible for the '/workflows/<workflowID>' GET request.
"""
result = None
......@@ -289,7 +289,7 @@ class WorkflowManager:
def getWorkflowStatusByID(self, id):
"""
Only the status of the workflow matching the given ID is returned.
Only the status of the workflow matching the given ID is returned.
This method is responsible for the '/workflows/<workflowID>/status' GET request.
"""
result = None
......@@ -305,7 +305,7 @@ class WorkflowManager:
def getAllWorkflows(self, usertoken):
"""
This method is responsible for the '/workflows/all' GET request and
returns all workflows belonging to one user.
returns all workflows belonging to one user.
"""
return wesDAO.get_all_user_workflows(usertoken)
......@@ -318,23 +318,23 @@ class WorkflowManager:
class WorkflowWrapper(threading.Thread):
"""
This class represents one workflow submitted to the API and is
a Runnable, as it is inheriting the Thread module. When a
workflow is started by the API, the matching workflow is
This class represents one workflow submitted to the API and is
a Runnable, as it is inheriting the Thread module. When a
workflow is started by the API, the matching workflow is
then executed as a Thread. The thread itself then starts the
toil-cwl-runner in a subprocess to actually execute the pipeline.
This allows the service to handle multiple requests at once. Other
than that, methods are implemented to provide all necessary informations
needed (i.e. retrieving the status of a workflow, persisting data
needed (i.e. retrieving the status of a workflow, persisting data
in the database, etc.).
Using the given name for the workflow from the authenticated user, a directory
Using the given name for the workflow from the authenticated user, a directory
structure is generated as follows:
---CURRDIR (CWLREST)
|
|---workflows
|
|---WORKFLOW_NAME
|---WORKFLOW_NAME
|
|---jobStore
|
......@@ -353,7 +353,7 @@ class WorkflowWrapper(threading.Thread):
|---work
|
|--- ... (toil-cwl-runner files)
The log.txt can then be parsed to get all informations needed (according to the GA4GH standard)
and saved in the database.
"""
......@@ -392,9 +392,9 @@ class WorkflowWrapper(threading.Thread):
self.createDirs()
self.workflowDBID = wesParser.parse_workflow(self.userToken, workflowName, self.cwlFilePath, wesDAO, self.ymlFilePath)
self.toilRunnerArgsList = ["toil-cwl-runner", "--maxMemory=3G", "--debugWorker", "--outdir="+self.outDir,"--workDir="+self.workDir, "--jobStore="+self.jobStoreForPipeline, "--singularity", self.cwlFilePath, self.ymlFilePath,]
self.toilRunnerArgsListRestart = ["toil-cwl-runner", "--maxMemory=3G", "--restart", "--debugWorker", "--clean=onSuccess", "--outdir="+self.outDir,"--workDir="+self.workDir, "--jobStore="+self.jobStoreForPipeline, "--singularity", self.cwlFilePath, self.ymlFilePath,]
threading.Thread.__init__(self)
self.toilRunnerArgsList = ["toil-cwl-runner", "--defaultMemory=4", "--debugWorker", "--outdir="+self.outDir,"--workDir="+self.workDir, "--jobStore="+self.jobStoreForPipeline, "--singularity", self.cwlFilePath, self.ymlFilePath,]
self.toilRunnerArgsListRestart = ["toil-cwl-runner", "--defaultMemory=4", "--restart", "--debugWorker", "--clean=onSuccess", "--outdir="+self.outDir,"--workDir="+self.workDir, "--jobStore="+self.jobStoreForPipeline, "--singularity", self.cwlFilePath, self.ymlFilePath,]
threading.Thread.__init__(self)
############################################################
#Section: Public Methods
############################################################
......
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