use execute_in_process
# ask-ai
a
use execute_in_process
s
The
execute_in_process
method is a convenient way to execute a Dagster job or graph within the same process as your script or test. This method is particularly useful for unit testing and local development because it allows you to quickly run and debug your code without setting up an external execution environment. When you use
execute_in_process
, you can expect the following behavior: - The execution will occur in the same process as the caller, which means there is no process isolation. - It is designed for testing and development, so by default, it does not write to a persistent Dagster instance or produce run records in Dagit UI. However, you can pass a
DagsterInstance
object to the
instance
parameter if you want to write run records to Dagit. - It is not suitable for production use cases where you need the robustness of process isolation and the full capabilities of Dagster's execution engines. To use
execute_in_process
, you would typically call it on a job or graph object like so:
Copy code
python result = my_job.execute_in_process()
You can also pass run configuration, inputs, and other parameters to
execute_in_process
to customize the execution according to your needs. Keep in mind that
execute_in_process
has some limitations. For example, it may not be suitable for jobs that are intended to run with a multi-process executor or for jobs that require certain execution environments. Additionally, as mentioned in the discussions, graphs with inputs cannot be used with
execute_in_process
at the time of the documentation's last update. For more detailed information on how to use
execute_in_process
and its parameters, you should refer to the official Dagster documentation.