Skip to content

2020 refresh #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
language: python
python:
- '2.7'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
before_install:
- sudo apt-get update -qq
- pip install toil[all]==3.20.0
- pip install . --process-dependency-links
- pip install .[toil]
- pip install -r dev-requirements.txt
script:
- flake8 wes_service wes_client
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ RUN apt-get update && \
sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger stretch main > /etc/apt/sources.list.d/passenger.list'

RUN apt-get update && \
apt-get install -y --no-install-recommends passenger python-setuptools build-essential python-dev python-pip git && \
pip install pip==9.0.3
apt-get install -y --no-install-recommends passenger python3-setuptools build-essential python3-dev python3-pip git && \
pip3 install pip==9.0.3

RUN apt-get install -y --no-install-recommends libcurl4-openssl-dev libssl1.0-dev

Expand Down
30 changes: 17 additions & 13 deletions cwl_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,27 @@ def begin(self):
loghandle, self.logname = tempfile.mkstemp()
with self.updatelock:
self.outdir = tempfile.mkdtemp()
self.proc = subprocess.Popen(["cwl-runner", self.path, "-"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=loghandle,
close_fds=True,
cwd=self.outdir)
self.proc = subprocess.Popen(
["cwl-runner", self.path, "-"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=loghandle,
close_fds=True,
cwd=self.outdir,
)
self.status = {
"id": "%sjobs/%i" % (request.url_root, self.jobid),
"log": "%sjobs/%i/log" % (request.url_root, self.jobid),
"run": self.path,
"state": "Running",
"input": json.loads(self.inputobj),
"output": None}
"output": None,
}

def run(self):
self.stdoutdata, self.stderrdata = self.proc.communicate(self.inputobj)
if self.proc.returncode == 0:
outobj = yaml.load(self.stdoutdata)
outobj = yaml.load(self.stdoutdata, Loader=yaml.FullLoader)
with self.updatelock:
self.status["state"] = "Success"
self.status["output"] = outobj
Expand Down Expand Up @@ -75,7 +78,7 @@ def resume(self):
self.status["state"] = "Running"


@app.route("/run", methods=['POST'])
@app.route("/run", methods=["POST"])
def runworkflow():
path = request.args["wf"]
with jobs_lock:
Expand All @@ -86,11 +89,11 @@ def runworkflow():
return redirect("/jobs/%i" % jobid, code=303)


@app.route("/jobs/<int:jobid>", methods=['GET', 'POST'])
@app.route("/jobs/<int:jobid>", methods=["GET", "POST"])
def jobcontrol(jobid):
with jobs_lock:
job = jobs[jobid]
if request.method == 'POST':
if request.method == "POST":
action = request.args.get("action")
if action:
if action == "cancel":
Expand All @@ -117,14 +120,14 @@ def logspooler(job):
time.sleep(1)


@app.route("/jobs/<int:jobid>/log", methods=['GET'])
@app.route("/jobs/<int:jobid>/log", methods=["GET"])
def getlog(jobid):
with jobs_lock:
job = jobs[jobid]
return Response(logspooler(job))


@app.route("/jobs", methods=['GET'])
@app.route("/jobs", methods=["GET"])
def getjobs():
with jobs_lock:
jobscopy = copy.copy(jobs)
Expand All @@ -139,6 +142,7 @@ def spool(jc):
else:
yield ", " + json.dumps(j.getstatus(), indent=4)
yield "]"

return Response(spool(jobscopy))


Expand Down
7 changes: 6 additions & 1 deletion cwltool_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ def main(args=None):

t = StringIO.StringIO(msg)
err = StringIO.StringIO()
if cwltool.main.main(["--outdir="+outdir] + args + ["-"], stdin=t, stderr=err) != 0:
if (
cwltool.main.main(
["--outdir=" + outdir] + args + ["-"], stdin=t, stderr=err
)
!= 0
):
sys.stdout.write(json.dumps({"cwl:error": err.getvalue()}))
sys.stdout.write("\n\n")
sys.stdout.flush()
Expand Down
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
flake8
pytest
black
89 changes: 46 additions & 43 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,50 @@
with open("README.pypi.rst") as readmeFile:
long_description = readmeFile.read()

setup(name='wes-service',
version='3.3',
description='GA4GH Workflow Execution Service reference implementation',
long_description=long_description,
author='GA4GH Containers and Workflows task team',
author_email='[email protected]',
url="https://github.com/common-workflow-language/cwltool-service",
download_url="https://github.com/common-workflow-language/cwltool-service",
license='Apache 2.0',
packages=["wes_service", "wes_client"],
package_data={'wes_service': ['openapi/workflow_execution_service.swagger.yaml']},
include_package_data=True,
install_requires=[
'future',
'connexion >= 2.0.2, < 3',
'ruamel.yaml >= 0.12.4, <= 0.15.77',
'schema-salad',
'subprocess32==3.5.2'
],
entry_points={
'console_scripts': ["wes-server=wes_service.wes_service_main:main",
"wes-client=wes_client.wes_client_main:main"]
},
extras_require={
"cwltool": ['cwlref-runner'],
"arvados": ["arvados-cwl-runner"
],
"toil": ["toil[all]==3.20.0"
]},
zip_safe=False,
platforms=['MacOS X', 'Posix'],
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries :: Python Modules'
setup(
name="wes-service",
version="4.0",
description="GA4GH Workflow Execution Service reference implementation",
long_description=long_description,
author="GA4GH Containers and Workflows task team",
author_email="[email protected]",
url="https://github.com/common-workflow-language/cwltool-service",
download_url="https://github.com/common-workflow-language/cwltool-service",
license="Apache 2.0",
python_requires="~=3.5",
setup_requires=['pytest-runner'],
tests_require=['pytest'],
packages=["wes_service", "wes_client"],
package_data={"wes_service": ["openapi/workflow_execution_service.swagger.yaml"]},
include_package_data=True,
install_requires=[
"connexion >= 2.0.2, < 3",
"ruamel.yaml >= 0.15.78, < 0.16",
"schema-salad",
"subprocess32==3.5.2",
],
entry_points={
"console_scripts": [
"wes-server=wes_service.wes_service_main:main",
"wes-client=wes_client.wes_client_main:main",
]
)
},
extras_require={
"cwltool": ["cwlref-runner"],
"arvados": ["arvados-cwl-runner"],
"toil": ["toil[cwl]==4.1.0"],
},
zip_safe=False,
platforms=["MacOS X", "Posix"],
classifiers=[
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Software Development :: Libraries :: Python Modules",
],
)
2 changes: 0 additions & 2 deletions test/test_client_util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import unittest
import os
import logging
Expand Down
2 changes: 0 additions & 2 deletions test/test_integration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import unittest
import time
import os
Expand Down
Loading