---
schema_version: "1"
id: e9b5d073b3b4212ff845abf2fe1eaddf64349b6d92d9ad9ce9567ccd0e4d4d44
title: 実行
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.8/dw-runtime-functions-run.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.8/dw-runtime-functions-run
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 154a1c48c97d03bb0d5bfefe7f8570f7ba2af3e1e82964f337e0673b6e1a686d
description: MuleSoft Documentation Site
release: "2.8"
latest: false
---
# 実行

## [](#run1)run(fileToExecute: String, fs: Dictionary<String>, readerInputs: Dictionary<ReaderInput> = {}, inputValues: Dictionary<Any> = {}, configuration: RuntimeExecutionConfiguration = {}): RunResult

指定されたコンテキストで入力スクリプトを実行し、現在のランタイムでスクリプトを実行します。

_実験的:_​ この関数は実験的機能であり、DataWeave の将来のバージョンで変更または削除される場合があります。

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>fileToExecute</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">実行するファイルの名前。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>fs</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">実行するファイルが含まれるファイルシステム。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>readerInput</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">読み取って実行にバインドする入力。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>inputValues</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">実行に直接バインドする入力。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>configuration</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">ランタイム設定。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、さまざまな入力での ​`run`​ の動作を示します。

#### [](#ソース)ソース

```DataWeave
import * from dw::Runtime
var jsonValue = {
  value: '{"name": "Mariano"}' as Binary {encoding: "UTF-8"},
  encoding: "UTF-8",
  properties: {},
  mimeType: "application/json"
}

var jsonValue2 = {
  value: '{"name": "Mariano", "lastName": "achaval"}' as Binary {encoding: "UTF-8"},
  encoding: "UTF-8",
  properties: {},
  mimeType: "application/json"
}

var invalidJsonValue = {
  value: '{"name": "Mariano' as Binary {encoding: "UTF-8"},
  encoding: "UTF-8",
  properties: {},
  mimeType: "application/json"
}

var Utils = "fun sum(a,b) = a +b"
---
{
  "execute_ok" : run("main.dwl", {"main.dwl": "{a: 1}"}, {"payload": jsonValue }),
  "logs" : do {
    var execResult = run("main.dwl", {"main.dwl": "{a: log(1)}"}, {"payload": jsonValue })
    ---
    {
        m: execResult.logs.message,
        l: execResult.logs.level
    }
  },
  "grant" : run("main.dwl", {"main.dwl": "{a: readUrl(`http://google.com`)}"}, {"payload": jsonValue }, { securityManager: (grant, args) -> false }),
  "library" : run("main.dwl", {"main.dwl": "Utils::sum(1,2)", "/Utils.dwl": Utils }, {"payload": jsonValue }),
  "timeout" : run("main.dwl", {"main.dwl": "(1 to 1000000000000) map \$ + 1" }, {"payload": jsonValue }, {timeOut: 2}).success,
  "execFail" : run("main.dwl", {"main.dwl": "dw::Runtime::fail('My Bad')" }, {"payload": jsonValue }),
  "parseFail" : run("main.dwl", {"main.dwl": "(1 + " }, {"payload": jsonValue }),
  "writerFail" : run("main.dwl", {"main.dwl": "output application/xml --- 2" }, {"payload": jsonValue }),
  "readerFail" : run("main.dwl", {"main.dwl": "output application/xml --- payload" }, {"payload": invalidJsonValue }),
  "defaultOutput" : run("main.dwl", {"main.dwl": "payload" }, {"payload": jsonValue2}, {outputMimeType: "application/csv", writerProperties: {"separator": "|"}}),
}
```

#### [](#出力)出力

```Json
{
  "execute_ok": {
    "success": true,
    "value": "{\n  a: 1\n}",
    "mimeType": "application/dw",
    "encoding": "UTF-8",
    "logs": [

    ]
  },
  "logs": {
    "m": [
      "1"
    ],
    "l": [
      "INFO"
    ]
  },
  "grant": {
    "success": false,
    "message": "The given required permissions: `Resource` are not being granted for this execution.\nTrace:\n  at readUrl (Unknown)\n  at main::main (line: 1, column: 5)",
    "location": {
      "start": {
        "index": 0,
        "line": 0,
        "column": 0
      },
      "end": {
        "index": 0,
        "line": 0,
        "column": 0
      },
      "content": "Unknown location"
    },
    "stack": [
      "readUrl (anonymous:0:0)",
      "main (main:1:5)"
    ],
    "logs": [

    ]
  },
  "library": {
    "success": true,
    "value": "3",
    "mimeType": "application/dw",
    "encoding": "UTF-8",
    "logs": [

    ]
  },
  "timeout": false,
  "execFail": {
    "success": false,
    "message": "My Bad\nTrace:\n  at fail (Unknown)\n  at main::main (line: 1, column: 1)",
    "location": {
      "start": {
        "index": 0,
        "line": 0,
        "column": 0
      },
      "end": {
        "index": 0,
        "line": 0,
        "column": 0
      },
      "content": "Unknown location"
    },
    "stack": [
      "fail (anonymous:0:0)",
      "main (main:1:1)"
    ],
    "logs": [

    ]
  },
  "parseFail": {
    "success": false,
    "message": "Invalid input \"1 + \", expected parameter or parenEnd (line 1, column 2):\n\n\n1| (1 + \n    ^^^^\nLocation:\nmain (line: 1, column:2)",
    "location": {
      "start": {
        "index": 0,
        "line": 1,
        "column": 2
      },
      "end": {
        "index": 4,
        "line": 1,
        "column": 6
      },
      "content": "\n1| (1 + \n    ^^^^"
    },
    "logs": [

    ]
  },
  "writerFail": {
    "success": false,
    "message": "Trying to output non-whitespace characters outside main element tree (in prolog or epilog), while writing Xml at .",
    "location": {
      "content": ""
    },
    "stack": [

    ],
    "logs": [

    ]
  },
  "readerFail": {
    "success": false,
    "message": "Unexpected end-of-input at payload@[1:18] (line:column), expected '\"', while reading `payload` as Json.\n \n1| {\"name\": \"Mariano\n                    ^",
    "location": {
      "content": "\n1| {\"name\": \"Mariano\n                    ^"
    },
    "stack": [

    ],
    "logs": [

    ]
  },
  "defaultOutput": {
    "success": true,
    "value": "name|lastName\nMariano|achaval\n",
    "mimeType": "application/csv",
    "encoding": "UTF-8",
    "logs": [

    ]
  }
}
```