Skip to content

cwltool fails first iteration when it needs to pull commonworkflowlanguage/nodejs-engine #32

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

Closed
denis-yuen opened this issue Jan 15, 2016 · 3 comments

Comments

@denis-yuen
Copy link
Member

Not sure if expected behaviour.

When cwltool needs to pull commonworkflowlanguage/nodejs-engine , it will fail running the tool. A second attempt succeeds.

ubuntu@cwl-sort-test:~/CancerCollaboratory/dockstore-tool-linux-sort$ cwltool --non-strict Dockstore.cwl test.json
/usr/local/bin/cwltool 1.0.20160108200940
Got workflow error
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cwltool/main.py", line 158, in single_job_executor
    for r in jobiter:
  File "/usr/local/lib/python2.7/dist-packages/cwltool/draft2tool.py", line 130, in job
    j.stdout = builder.do_eval(self.tool["stdout"])
  File "/usr/local/lib/python2.7/dist-packages/cwltool/builder.py", line 165, in do_eval
    context=context, pull_image=pull_image)
  File "/usr/local/lib/python2.7/dist-packages/cwltool/expression.py", line 135, in do_eval
    return sandboxjs.interpolate(ex, jshead(r.get("expressionLib", []), rootvars))
  File "/usr/local/lib/python2.7/dist-packages/cwltool/sandboxjs.py", line 128, in interpolate
    e = execjs(scan[w[0]+1:w[1]], jslib)
  File "/usr/local/lib/python2.7/dist-packages/cwltool/sandboxjs.py", line 41, in execjs
    raise JavascriptException("Returncode was: %s\nscript was: %s\nstdout was: '%s'\nstderr was: '%s'\n" % (nodejs.returncode, script, stdoutdata, stderrdata))
JavascriptException: Returncode was: 2
script was: console.log(JSON.stringify(require("vm").runInNewContext("\"use strict\";var inputs = {\"allocatedResources\": {\"mem\": 1000, \"cpu\": 1}, \"input\": [{\"path\": \"file:///home/ubuntu/CancerCollaborat
ory/dockstore-tool-linux-sort/example.bedGraph\", \"class\": \"File\"}], \"key\": [\"1,1\", \"2,2n\"], \"output\": \"example.bedGraph.sorted\"};\nvar self = null;\nvar runtime = {\"outdirSize\": 1024, \"ram\": 102
4, \"tmpdirSize\": 1024, \"cores\": 1, \"tmpdir\": \"/tmp/job_tmp\", \"outdir\": \"/tmp/job_output\"};\n(function(){return ((inputs.output));})()", {})));

stdout was: ''
stderr was: 'Unable to find image 'commonworkflowlanguage/nodejs-engine:latest' locally
latest: Pulling from commonworkflowlanguage/nodejs-engine
f9443a9b4216: Pulling fs layer
1ddcf54c0400: Pulling fs layer
e091dad1ae93: Pulling fs layer
41f5a9faf342: Pulling fs layer
41f5a9faf342: Verifying Checksum
41f5a9faf342: Download complete
1ddcf54c0400: Verifying Checksum
1ddcf54c0400: Download complete
e091dad1ae93: Verifying Checksum
e091dad1ae93: Download complete
'

Workflow error:
  Returncode was: 2
script was: console.log(JSON.stringify(require("vm").runInNewContext("\"use strict\";var inputs = {\"allocatedResources\": {\"mem\": 1000, \"cpu\": 1}, \"input\": [{\"path\": \"file:///home/ubuntu/CancerCollaborat
ory/dockstore-tool-linux-sort/example.bedGraph\", \"class\": \"File\"}], \"key\": [\"1,1\", \"2,2n\"], \"output\": \"example.bedGraph.sorted\"};\nvar self = null;\nvar runtime = {\"outdirSize\": 1024, \"ram\": 102
4, \"tmpdirSize\": 1024, \"cores\": 1, \"tmpdir\": \"/tmp/job_tmp\", \"outdir\": \"/tmp/job_output\"};\n(function(){return ((inputs.output));})()", {})));

stdout was: ''
stderr was: 'Unable to find image 'commonworkflowlanguage/nodejs-engine:latest' locally
latest: Pulling from commonworkflowlanguage/nodejs-engine
f9443a9b4216: Pulling fs layer
1ddcf54c0400: Pulling fs layer
e091dad1ae93: Pulling fs layer
41f5a9faf342: Pulling fs layer
41f5a9faf342: Verifying Checksum
41f5a9faf342: Download complete
1ddcf54c0400: Verifying Checksum
1ddcf54c0400: Download complete
e091dad1ae93: Verifying Checksum
e091dad1ae93: Download complete
'

ubuntu@cwl-sort-test:~/CancerCollaboratory/dockstore-tool-linux-sort$ cwltool --non-strict Dockstore.cwl test.json
/usr/local/bin/cwltool 1.0.20160108200940
[job 139960086713808] /home/ubuntu/CancerCollaboratory/dockstore-tool-linux-sort$ docker run -i --volume=/home/ubuntu/CancerCollaboratory/dockstore-tool-linux-sort/example.bedGraph:/tmp/job299693805_dockstore-tool
-linux-sort/example.bedGraph:ro --volume=/home/ubuntu/CancerCollaboratory/dockstore-tool-linux-sort:/tmp/job_output:rw --volume=/tmp/tmpMKbQ3D:/tmp/job_tmp:rw --workdir=/tmp/job_output --read-only=true --user=1000
 --rm --env=TMPDIR=/tmp/job_tmp quay.io/collaboratory/dockstore-tool-linux-sort sort -k 1,1 -k 2,2n /tmp/job299693805_dockstore-tool-linux-sort/example.bedGraph > /home/ubuntu/CancerCollaboratory/dockstore-tool-li
nux-sort/example.bedGraph.sorted
Final process status is success
{
    "sorted": {
        "path": "/home/ubuntu/CancerCollaboratory/dockstore-tool-linux-sort/example.bedGraph.sorted", 
        "size": 796, 
        "class": "File", 
        "checksum": "sha1$36b0a5a18a584d095597912b702251f90db60a64"
    }
}

Workaround: pre-load the engine via docker pull commonworkflowlanguage/nodejs-engine

Dockstore.cwl.txt

@prismofeverything
Copy link
Contributor

Now the workaround is docker pull node:slim

@tetron
Copy link
Member

tetron commented Mar 15, 2016

I think I know what the problem is. cwltool sets a timeout to terminate the expression so that it can't run too long. When doing docker run node:slim it exceeds the timeout the first time because it is downloading the image. The correct fix is for cwltool to run docker pull separately before docker run as suggested by @prismofeverything

tetron pushed a commit that referenced this issue Apr 11, 2016
@tetron
Copy link
Member

tetron commented Apr 11, 2016

Now pulls the image before calling docker run.

@tetron tetron closed this as completed Apr 11, 2016
mr-c added a commit that referenced this issue Jun 10, 2016
3e1b02c Merge commit '6ac559ed62780091eb0cfff914018ed101ef46ef' into scoped-ref-and-typedsl
6ac559e version bump
2cfde6b Merge pull request #32 from common-workflow-language/type_dsl
b8edddc re-enable test_avro_regression
bedb736 Merge branch 'type_dsl' of github.com:common-workflow-language/schema_salad into type_dsl
e93b038 Add missing file
9ca6cc9 remove more str types, possible fix for edam failed test
d65fb83 more unicode
4350b30 type clarification
96f08e8 Merge remote-tracking branch 'origin/master' into type_dsl
57f7e83 borrow the updated re.pyi from typeshed
c03eb1e type fixes
6e71f35 Merge remote-tracking branch 'origin/master' into type_dsl
68a5c6c More updating to draft-4.dev2
97e8f75 More updating to draft-4.dev2
e554b2b Merge pull request #33 from common-workflow-language/fix-resolve_all_refactor
ad34521 fix bug introduced by refactor
5393edc fixes types, removes a few more Anys
e298bdc Detect when an abstract class is used but doesn't have a concrete subtype.

git-subtree-dir: cwltool/schemas
git-subtree-split: 3e1b02c
mr-c added a commit that referenced this issue Jul 6, 2016
mr-c pushed a commit that referenced this issue Jul 6, 2016
c509a07 Merge pull request #34 from common-workflow-language/unscoped_ids
f857e9d type fixups
0407370 Allow idmaps for record fields.
5d9a08e Use makerdf for --print-rdf
ce00252 Add test for non-scoped identifiers.
ef27301 restore a dropped cast
6ac559e version bump
2cfde6b Merge pull request #32 from common-workflow-language/type_dsl
b8edddc re-enable test_avro_regression
bedb736 Merge branch 'type_dsl' of github.com:common-workflow-language/schema_salad into type_dsl
e93b038 Add missing file
9ca6cc9 remove more str types, possible fix for edam failed test
d65fb83 more unicode
4350b30 type clarification
96f08e8 Merge remote-tracking branch 'origin/master' into type_dsl
57f7e83 borrow the updated re.pyi from typeshed
c03eb1e type fixes
6e71f35 Merge remote-tracking branch 'origin/master' into type_dsl
e554b2b Merge pull request #33 from common-workflow-language/fix-resolve_all_refactor
ad34521 fix bug introduced by refactor
5393edc fixes types, removes a few more Anys
e298bdc Detect when an abstract class is used but doesn't have a concrete subtype.
851b3c1 Split minimal base types used in CWL into metaschema_base.yml
8823aaa Adjust ref scopes
3431e18 Use scopedRef and typeDSL in metaschema
1e6dab6 Using typeDSL in metaschema.
3055f70 Update bootstrap context.
31db28e Merge branch 'master' into type_dsl.  Add test for typeDSL.
116d9e4 Merge branch 'resolve_all_refactor'
8072bf5 "type" DSL wip
33ef215 Refactor resolve_all into smaller methods.
ad8a111 Merge pull request #28 from common-workflow-language/scoped_ref
5aadf27 fix types
4ef52be Improve documentation.  Add feature of skipping some inner scopes.
c6d4a7b Reworking refScope to be fixed instead of search based.
ae0ef4e Remove explicit calls to validate_links since it is folded into resolve_all().
2fa6bfb update types
e5d4730 New test for scoped ref that better reflects actual desired behavior.
efbc9c4 Add scopedRef to metaschema.  Tweak test.
9fcd67d Fold link validation into resolve_all() and resolve scoped identifiers.
da10eec always be updating (mypy-lang)
e1e17ea upgrade Jenkins setuptools
563e5ef fix jenkins build
f0ac285 Merge branch 'master' of github.com:common-workflow-language/schema_salad
84738f1 better RDF schema error handling (#26)
3b8dc09 mypy 0.4 is out (#25)
8c5bda0 Fix mapSubject fields when $import or $include is provided.
5b969ca fix diff-cover
d798a7e split out mypy
f43fa45 Fix tests
2d0398e Bump version.
aeab7c3 Merge branch 'master' of github.com:common-workflow-language/schema_salad
e381f64 Return metaschema loader from load_schema.  Don't crash expanding identifier fields when value is not a string.
15dae9f enhance CI
fd2fcb3 more type checking (#21)
c51c723 enable rdfa schema format (#22)
ff192e8 turn off py3 support for now (#19)
0c5dba5 measure code coverage (#12)
2514a23 switch to ruamel.yaml, use C loader if available, only load safely (#20)
37c129d Merge branch 'master' of github.com:common-workflow-language/schema_salad
0b09a19 Makedoc detects any ``` for toggling looking for # for section headings.
d361b6c Bump version #
2da084e Add mapSubject and mapPredicate to metaschema.
2b00752 Turn idMap into mapSubject and mapPredicate.
af7a419 Support id maps in preprocessing.
984ab9c Fix makedoc section header bug.
cc0f52b Add margin to <pre> sections in generated documentation.

git-subtree-dir: draft-4/salad
git-subtree-split: c509a07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants