How do I pass a resource into a job using execute_...
# ask-ai
s
How do I pass a resource into a job using execute_in_process
s
To pass a resource into a job using
execute_in_process
, you can specify the resources as part of the
resources
parameter when calling the method. Here's an example based on the documentation:
Copy code
python @job(resource_defs={"my_resource": my_resource_definition}) def my_job():     ...  result = my_job.execute_in_process(resources={"my_resource": my_resource_instance})
In this example,
my_resource_definition
is the resource definition that you've created, and
my_resource_instance
is the actual resource instance you want to use during the in-process execution of the job. The
resources
parameter allows you to override the resource definitions for the execution of the job. Please note that the
execute_in_process
method is designed for testing and development purposes, as it executes the job in the same process as the one from which it is called. This means that the
executor_def
on the job will be ignored and replaced with the in-process executor, and if using the default
io_manager
, it will switch from filesystem to in-memory.