From 255d350226cf7b848b4cec6462062b9cc8427dfa Mon Sep 17 00:00:00 2001 From: "Artem V. Navrotskiy" Date: Tue, 21 Sep 2021 10:26:30 +0300 Subject: [PATCH] Fix error in worker declaration example sniplet With line: ``` executable=ctx.attr.worker, ``` I got error like: ``` Error in run: in call to run(), parameter 'executable' got value of type 'Target', want 'File, string, or FilesToRunProvider' ``` --- site/docs/creating-workers.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/site/docs/creating-workers.md b/site/docs/creating-workers.md index e7eec5317f0cb4..1025d1dda2219a 100644 --- a/site/docs/creating-workers.md +++ b/site/docs/creating-workers.md @@ -44,12 +44,12 @@ for singleplex workers. ```json { - “args” : [“--some_argument”], - “inputs” : [ - { “/path/to/my/file/1” : “fdk3e2ml23d”}, - { “/path/to/my/file/2” : “1fwqd4qdd” } - ], - “request_id” : 12 + "args" : ["--some_argument"], + "inputs" : [ + { "/path/to/my/file/1" : "fdk3e2ml23d"}, + { "/path/to/my/file/2" : "1fwqd4qdd" } + ], + "request_id" : 12 } ``` @@ -70,10 +70,9 @@ to redirect the `stdout` of any tools it uses to `stderr`. ```json { - “exit_code” : 1, - “output” : “Action failed with the following message:\nCould not find input - file “/path/to/my/file/1”, - “request_id” : 12 + "exit_code" : 1, + "output" : "Action failed with the following message:\nCould not find input file \"/path/to/my/file/1\"", + "request_id" : 12 } ``` @@ -84,7 +83,7 @@ id, so the request id must be specified if it is nonzero. This is a valid ```json { - “request_id” : 12, + "request_id" : 12, } ``` @@ -215,13 +214,14 @@ startup args, the call to `ctx.actions.run` might be: ```python ctx.actions.run( inputs=ctx.files.srcs, - outputs=[ctx.attr.output], - executable=ctx.attr.worker, + outputs=[ctx.outputs.output], + executable=ctx.executable.worker, mnemonic="someMnemonic", execution_requirements={ - “supports-workers” : “1”, - “requires-worker-protocol” : “json}, - arguments=ctx.attr.args + [“@flagfile”] + "supports-workers" : "1", + "requires-worker-protocol" : "json", + }, + arguments=ctx.attr.args + ["@flagfile"] ) ```