https://dagster.io/ logo
Title
e

Emily

06/07/2021, 6:25 PM
hello :dagster: friends, im trying to work with the python graphql client, and im following this example here just to get a run status, but i keep getting an error that it failed graphql validation. all of it works besides the
get_run_status
part. this is the code:
from dagster_graphql import DagsterGraphQLClient
from dagster_graphql import DagsterGraphQLClientError
from dagster.core.storage.pipeline_run import PipelineRunStatus

client = DagsterGraphQLClient(hostname='<our_host>')

RUN_ID = '33f2ed15-b2fe-4d37-bac9-adec6b8ebe3b'

try:
    status: PipelineRunStatus = client.get_run_status(RUN_ID)
    if status == PipelineRunStatus.SUCCESS:
        print('yay')
    else:
        print('ugh')
except DagsterGraphQLClientError as exc:
    print('why')
    raise exc
error:
DagsterGraphQLClientError: Query 

query($runId: ID!) {
  pipelineRunOrError(runId: $runId) {
    __typename
    ... on PipelineRun {
        status
    }
    ... on PipelineRunNotFoundError {
      message
    }
    ... on PythonError {
      message
    }
  }
}

 with variables 
{'runId': '33f2ed15-b2fe-4d37-bac9-adec6b8ebe3b'}
 failed GraphQL validation
o

owen

06/07/2021, 6:43 PM
hey @Emily! Just as a first pass, is it possible that the dagit version on your host is different than the dagster version that you're running that script on?
e

Emily

06/07/2021, 7:16 PM
confirmed its on the same version
0.11.9
o

owen

06/07/2021, 7:47 PM
Interesting, thanks for checking -- is your host behind a proxy of some sort or have some special configuration (like OAuth etc.)? It might also be worth checking if your script works locally (i.e.
dagit -f <some random pipeline>
on your local machine, then put
127.0.0.1:3000
for the hostname), which could narrow things down a bit.
cc @sid
s

sid

06/07/2021, 7:48 PM
Just saw this - taking a look now!
e

Emily

06/07/2021, 7:49 PM
its behind VPN but im on it, and the
DagsterGraphQLClient
part connects fine
trying locally, this actually doesnt work
client = DagsterGraphQLClient(hostname='127.0.0.1', port_number=3000)
and i get this error
ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=3000): Max retries exceeded with url: /graphql (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fc7651f8690>: Failed to establish a new connection: [Errno 111] Connection refused'))
it looks like its not building the URL correctly
url: /graphql
when it should be
<http://127.0.0.1:3000/graphql>
it doesnt like when i add on
http://
either
this is the error with that
ConnectionError: HTTPConnectionPool(host='http', port=80): Max retries exceeded with url: //127.0.0.1:3000/graphql (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fc76526efd0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
url: //127.0.0.1:3000/graphql
s

sid

06/07/2021, 8:16 PM
Hmm so the
DagsterGraphQLClient
object tries to eagerly (rather than lazily) connect to dagit via HTTP so if there’s no dagit running that’s the error you’ll see - I think those error messages are obviously a bit obtuse though, so I’ll put up a patch for that. Apologize for the confusion.
I’ll message you offline about the first error, which is a bit puzzling - I was unable to get a repro locally on a fresh install of 0.11.9, so on a first pass I think it has to do with the VPN stuff
o

owen

06/07/2021, 8:21 PM
it is pretty confusing to me that it is able to connect though (I forgot about that in my first pass 🤦), because that process involves firing a graphql query off iirc, so if that part succeeds it's strange that the other query wouldn't. I'll let @sid take this from here though, as he is a bit more knowledgeable than me on this 😛