Skip to content

Executions API#

Creation#

[source]

run#

Job.run(args=None, await_termination=False)

Run the job, with the option of passing runtime arguments.

Example of a blocking execution and downloading logs once execution is finished.

# Run the job
execution = job.run(await_termination=True)

# True if job executed successfully
print(execution.success)

# Download logs
out_log_path, err_log_path = execution.download_logs()
Arguments

  • args str | None: optional runtime arguments for the job
  • await_termination bool: if True wait until termination is complete

Returns

Execution. The execution object for the submitted run.


Retrieval#

[source]

get_executions#

Job.get_executions()

Retrieves all executions for the job ordered by submission time.

Returns

List[Execution]

Raises

RestAPIError in case the backend fails to retrieve executions.


Properties#

[source]

app_id#

Application id for the execution


[source]

args#

Arguments set for the execution.


[source]

duration#

Duration in milliseconds the execution ran.


[source]

final_status#

Final status of the execution. Can be UNDEFINED, SUCCEEDED, FAILED or KILLED.


[source]

hdfs_user#

Filesystem user for the execution.


[source]

id#

Id of the execution


[source]

job_name#

Name of the job the execution belongs to


[source]

job_type#

Type of the job the execution belongs to


[source]

progress#

Progress of the execution.


[source]

state#

Current state of the execution.


[source]

stderr_path#

Path in Hopsworks Filesystem to stderr log file


[source]

stdout_path#

Path in Hopsworks Filesystem to stdout log file


[source]

submission_time#

Timestamp when the execution was submitted


[source]

success#

Boolean to indicate if execution ran successfully or failed

Returns

bool. True if execution ran successfully. False if execution failed or was killed.


[source]

user#

User that submitted the execution.


Methods#

[source]

await_termination#

Execution.await_termination()

Wait until execution reaches terminal state

Raises

RestAPIError.


[source]

delete#

Execution.delete()

Delete the execution

Potentially dangerous operation

This operation deletes the execution.

Raises

RestAPIError.


[source]

download_logs#

Execution.download_logs(path=None)

Download stdout and stderr logs for the execution Example for downloading and printing the logs

# Download logs
out_log_path, err_log_path = execution.download_logs()

out_fd = open(out_log_path, "r")
print(out_fd.read())

err_fd = open(err_log_path, "r")
print(err_fd.read())

Arguments

  • path: path to download the logs. must be str

Returns

str. Path to downloaded log for stdout. str. Path to downloaded log for stderr.


[source]

get_url#

Execution.get_url()

[source]

stop#

Execution.stop()

Stop the execution

Potentially dangerous operation

This operation stops the execution.

Raises

RestAPIError.