800-596-4880 ](tel:1-800-596-4880)

Online  [ Contact Us ](https://www.mulesoft.com/contact)

  * Login 

[ Anypoint Platform
](https://anypoint.mulesoft.com/login/#/signin?apintent=generic) [ Composer
](https://composer.mulesoft.com/login/sign-in) [ Training
](https://training.mulesoft.com/login) [ Help Center
](https://help.mulesoft.com/s/login/)

[ Free trial ](https://anypoint.mulesoft.com/login/#/signup?apintent=generic)

[ Link to MuleSoft Twitter profile  ](https://twitter.com/MuleSoft) [ Link to
MuleSoft Linkedin profile  ](https://www.linkedin.com/company/mulesoft) [ Link
to MuleSoft Facebook page  ](https://www.facebook.com/MuleSoft) [ Link to
MuleSoft Instagram profile  ](https://www.instagram.com/mulesoft/) [ Link to
MuleSoft Videos platform  ](https://videos.mulesoft.com/) [ Link to MuleSoft
Twitch profile  ](https://www.twitch.tv/mulesoft_community)

© Copyright 2024  Salesforce, Inc. [ All rights reserved
](https://www.salesforce.com/company/legal/intellectual/) .

![](../../_/img/icons/arrow-down.svg)

Skip to main content

[ View on GitHub ](https://github.com/mulesoft/docs-
dataweave/blob/v2.6/modules/ROOT/pages/dw-runtime-functions-run.adoc)

#  On this page:

Menu

  1. [ Homepage  ](../../general/)
  2. [ DataWeave (2.6) ](./)
  3. [ DataWeave Reference ](dw-functions)
  4. [ dw::Runtime ](dw-runtime)
  5. run 

![](../../_/img/icons/arrow-down.svg) ![](../../_/img/icons/search.svg)

  1. [ Homepage  ](../../general/)
  2. [ DataWeave (2.6) ](./)
  3. [ DataWeave Reference ](dw-functions)
  4. [ dw::Runtime ](dw-runtime)
  5. run 

#  run

##  run(fileToExecute: String, fs: Dictionary<String>, readerInputs: Dictionary<ReaderInput> = {}, inputValues: Dictionary<Any> = {}, configuration: RuntimeExecutionConfiguration = {}): RunSuccess | ExecutionFailure 

Runs the input script under the provided context and executes the script in
the current runtime.

_Experimental:_ This function is an experimental feature that is subject to
change or removal from future versions of DataWeave.

###  Parameters

Name  |  Description   
---|---  
` fileToExecute ` |  Name of the file to execute.   
` fs ` |  File system that contains the file to execute.   
` readerInput ` |  Inputs to read and bind to the execution.   
` inputValues ` |  Inputs to bind directly to the execution.   
` configuration ` |  The runtime configuration.   
  
###  Example

This example shows how ` run ` behaves with different inputs.

####  Source

    
    
    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", {"