# Run Remotely
source: https://docs.chalk.ai/docs/chalkdf/remote-execution

## Test a plan locally, submit it to a Chalk environment, follow the job, and retrieve its rows.

A DataFrame plan can run in your Python process or on a worker in your Chalk environment. Test the transformation on a few rows first. Then submit the same plan to Chalk and use the job handle to retrieve the result.

### Check the query locally

Install `chalkdf` and `chalkpy`. From your project directory, sign in with `chalk login` and use `chalk config` to check which environment will receive the job. The local calculation uses three purchases.

```python
from chalk import _
from chalkdf import DataFrame

orders = DataFrame.from_dict({"user": ["a", "a", "b"], "amount": [12, 8, 30]})
totals = orders.agg(["user"], _.amount.sum().alias("spend")).order_by("user")
totals.run()
```

| user · `string` | spend · `int64` |
| --------------- | --------------- |
| a               | 20              |
| b               | 30              |

### Submit the plan and retrieve the result

[`remote_run()`](/dataframe-docs#DataFrame.remote_run) submits a serializable plan and returns a job handle. You can continue working while the job runs. Call `wait()` when you need the rows. Chalk reports the run's progress and dashboard link while you wait.

```python
job = totals.remote_run(correlation_id="chalkdf-docs-example")
job.wait()
```

| user · `string` | spend · `int64` |
| --------------- | --------------- |
| a               | 20              |
| b               | 30              |

Both runs produce the same ordered totals. Use `job.operation_id` to identify this particular run and `job.status()` to poll it. The correlation ID is a label you supply, for example to associate several runs with one workflow. If a job fails or is canceled, `wait()` raises `DataFrameRunFailedError`. Inspect its `status`, `error_message`, and `dashboard_url` to investigate the attempt.

Read the terminal status after retrieving the result.

```python
import pyarrow as pa

pa.table({"status": [job.status()]})
```

| status · `string` |
| --- |
| COMPLETED |

### Read a completed result again

Save the operation ID if you plan to revisit the result from another session. An authenticated client can request fresh, short-lived download URLs for the completed run's Parquet files. Scan those files to build a new query over the saved rows.

```python
from chalk.client.client_grpc import ChalkGRPCClient

client = ChalkGRPCClient()
files = client.get_dataframe_run_download_urls(job.operation_id)
saved = DataFrame.scan(files)
saved.filter(_.spend >= 25).select("user", "spend").run()
```

| user · `string` | spend · `int64` |
| --------------- | --------------- |
| b               | 30              |

This query reads the saved totals and filters them locally. The original aggregation ran once on the worker. In a later session, pass the saved operation ID to the client and request new URLs.

### Inspect a run in the dashboard

Open the dashboard link printed by `wait()`. In **Details**, check the status and attempts. Open **Static Plan** to trace the operations you submitted. In **Performance**, compare input rows, output rows, and memory by operator. For a grouped query, a large drop between input and output rows tells you where the aggregation reduced the data. Open **Results** to inspect the output.

### Choose the input and worker

| Decision                    | How to configure it                                                                                                                                                                                                                                                                                                                                         |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Where the worker reads data | A frame built with [`from_dict`](/dataframe-docs#DataFrame.from_dict) carries its small input in the plan. For larger inputs, point [`DataFrame.scan`](/dataframe-docs#DataFrame.scan) at files the worker can read in object storage, or use a configured SQL data source. A laptop-local file path must also be accessible to the worker to run remotely. |
| Which resources run the job | Pass the name of a configured resource group to [`remote_run(resource_group=...)`](/dataframe-docs#DataFrame.remote_run). The worker uses the resources configured for that group.                                                                                                                                                                          |
| How much data comes back    | Filter, aggregate, or project in the plan before calling [`remote_run()`](/dataframe-docs#DataFrame.remote_run). The example returns one row per user. Calling `wait()` retrieves the materialized result for the client.                                                                                                                                   |
| How to follow execution     | Open the DataFrame run in the dashboard to inspect attempts and performance. The SDK requests performance summary updates every five seconds by default. Set `update_performance_summary_interval_secs` to change the interval, or to zero to disable updates.                                                                                              |

For recurring feature computation, use the same DataFrame transformations in a [static resolver](/docs/static-resolvers). To call a deployed function on each row in a remote query or resolver, see [Catalog calls](/docs/functions/calling-from-a-dataframe). For input configuration, see [Files](/docs/chalkdf/io/files) and [SQL](/docs/chalkdf/io/data-sources).





