Hey all. Have a question here. How do you debug in...
# ask-community
c
Hey all. Have a question here. How do you debug into an op if say you want to step into it ? Currently I have to put pdb.set_trace() in the op. I am wondering if there is a way to force only single thread running so we can simple toggle the breakpoint from pycharm IDE.
🤖 1
r
s
you can also use the
in_process_executor
to make all ops execute in a single thread
c
Thanks guys, will give it a try.
hum, not sure where my understanding is wrong. Let's say I have simple example:
Copy code
def op_1():
    print("op_1")


def op_2():
    print("op_2")


def simple_job():
    op_1()
    op_2()


simple_job()
in the plain python, from pycharm IDE, I can just toggle a breakpoint inside op_1 or op_2, and if i run it in the debug mode, the program will stop at the breakpoint inside the op_1 and op_2, as long as I have a breakpoint there
But if I have a dagster version of the same thing:
Copy code
from dagster import op, job

@op
def op_1():
    print("op_1")

@op
def op_2():
    print("op_2")

@job
def simple_job():
    op_1()
    op_2()


simple_job.execute_in_process()
s
if you run that from pycharm, does your breakpoint not work? or you run into issues when running from dagit?
c
now in the pycharm IDE, if i toggle a breakpoint inside op_1 or op_2, and start the program in debug mode, it won't stop.
so execute_in_process() actually will execute the whole thing in a single thread ?
s
yeah - it should execute the whole thing in a single thread
I would expect it to stop
c
yeah if you use pycharm, can you give it a quick test ?
It won't stop for me, for whatever reason.
s
alas, I am not a pycharm user
c
lol. what IDE do you use ?
s
sublime 😱
which doesn't have breakpoints as far as I know
c
@sandy Thanks for the help anyway. Super enjoyed you software asset talk. If you happened to have any colleague using pycharm, maybe they can give it a try ?
s
🙏 thank you I'll post to see if anyone is familiar
c
@sandy I am sorry. Yeah it did stop. Thanks for the help again.
where I got confused is that i put breakpoint in the job and from there try to step into op, that won't work. But if you put breakpoint inside the op, execution will stop there.
s
ahh. that makes sense