Helpers
- gretel_client.helpers.do_api_call(method: str, path: str, query_params: dict | None = None, body: dict | None = None, headers: dict | None = None, *, session: ClientConfig | None = None) dict
Make a direct API call to Gretel Cloud.
- Parameters:
method – “get”, “post”, etc
path – The full path to make the request to, any path params must be already included. Example: “/users/me”
query_params – Optional URL based query parameters
body – An optional JSON payload to send
headers – Any custom headers that need to bet set.
session – the session to use, or
None
to use the default session.
Note
This function will automatically inject the appropriate API hostname and authentication from the Gretel configuration.
- gretel_client.helpers.poll(job: Job, wait: int = -1, verbose: bool = True) None
Polls a
Model
orRecordHandler
.- Parameters:
job – The job to poll.
wait – The time to wait for the job to complete.
verbose –
False
uses new quiet polling, defaults toTrue
.
- gretel_client.helpers.submit_docker_local(job: Job, *, output_dir: str | Path | None = None, in_data: str | Path | None = None, ref_data: Dict[str, str | Path] | None = None, model_path: str | Path | None = None) ContainerRun
Run a Job from a local docker container.
While the Job is running, the submit_docker_local function will block and periodically send back status updates as the Job progresses.
Note: Please ensure the Job has not already been submitted. If the Job has already been submitted, the run will fail.
- Parameters:
job – The job to run. May be either a
Model
orRecordHandler
.output_dir – A directory path to write the output to. If the directory does not exist, the path will be created for you. If no path is specified, the current working directory is used.
in_data – Input data path.
ref_data – Reference data path or dict where values are reference data path
model_path – If you are running a
RecordHandler
, this is the path to the model that is being ran.
- Returns:
A
ContainerRun
that can be used to manage the lifecycle of the associated local docker container.