https://dagster.io/ logo
#ask-community
Title
# ask-community
g

Gowtham Manne

08/16/2022, 4:28 PM
Hi All, I am starting a job which is present in first project (repos) from second project (API) using graphql. I am using
Copy code
mutation LaunchRunMutation(
  $repositoryLocationName: String!
  $repositoryName: String!
  $jobName: String!
  $runConfigData: RunConfigData!
) {
  launchRun(
    executionParams: {
      selector: {
        repositoryLocationName: $repositoryLocationName
        repositoryName: $repositoryName
        jobName: $jobName
      }
      runConfigData: $runConfigData
    }
  ) {
    __typename
    ... on LaunchRunSuccess {
      run {
        runId
      }
    }
    ... on RunConfigValidationInvalid {
      errors {
        message
        reason
      }
    }
    ... on PythonError {
      message
    }
  }
}
 How can I pass custom parameter to the job ?
🤖 1
s

sandy

08/16/2022, 5:54 PM
@prha are you able to help with this?
p

prha

08/16/2022, 5:57 PM
Hi @Gowtham Manne … I’m not sure what you mean by custom parameter here. Are you running into some configuration issue?
g

Gowtham Manne

08/16/2022, 5:59 PM
Hi @prha Thanks for the reply. Not Really. I have job That takes a input of List of string. How can we pass the parameter using above graphql query ??
p

prha

08/16/2022, 6:06 PM
I think jobs themselves don’t take inputs, but they can compose a bunch of ops that can take inputs. Jobs that contain ops with unconnected inputs may be launched by providing those values in a number of different ways. You can provide those values using an input manager or by providing the values in the run config. You can read more about it here: https://docs.dagster.io/concepts/io-management/unconnected-inputs I’d recommend first making sure you can launch runs in the first project with all the unconnected inputs getting satisfied (maybe using launchpad), and then later using the run config you need to launch via the graphql API.
g

Gowtham Manne

08/16/2022, 6:11 PM
@prha But here I am starting/launch the job/op using an graphql. Can I pass input parameter for the ops/jobs from using graphql. Like context for example from above example you provided?
p

prha

08/16/2022, 6:16 PM
In the example “loading-a-built-in-dagster-type-from-config”, the value was provided via run config. The launch run graphql mutation allows you to pass run config in (the 4th argument).
g

Gowtham Manne

08/16/2022, 6:18 PM
Just wanted to make sure this is the one you are talking about right ?
Copy code
runConfigData: $runConfigData
👍 1
Thank you!
@prha runConfigData : "somevalue" is through json.decoder.JSONDecoderERROR. Does this has to be an Object or just a string is fine? Do you have an graphql example of the same ? That will be every help ful
p

prha

08/16/2022, 9:04 PM
Here’s the schema description of
RunConfigData
:
Copy code
"""
This type is used when passing in a configuration object
        for pipeline configuration. Can either be passed in as a string (the
        YAML configuration object) or as the configuration object itself. In
        either case, the object must conform to the constraints of the dagster config type system.
"""
scalar RunConfigData
It depends on how you’re passing it in (probably via Python?), but you either pass a run config dictionary
Copy code
# example run config dictionary, from the docs example
{"ops": {"my_op": {"inputs": {"input_string": {"value": "marmot"}}}}}
or the yaml string of the run config dictionary:
Copy code
# example run config yaml, from the docs example
ops:
  my_op:
    inputs:
      input_string: 
        value: "marmot"
I would recommend you first familiarize yourself with the required run config needed to launch your job in repository A (using launchpad) before then trying to launch using the GraphQL API.
2 Views