JobResourceFile

class hailtop.batch.resource.JobResourceFile(value, source)

Bases: ResourceFile

Class representing an intermediate file from a job.

Examples

j.ofile is a JobResourceFile on the job`j`:

>>> b = Batch()
>>> j = b.new_job(name='hello-tmp')
>>> j.command(f'echo "hello world" > {j.ofile}')
>>> b.run()

Notes

All JobResourceFile are temporary files and must be written to a permanent location using Batch.write_output() if the output needs to be saved.

Methods

add_extension

Specify the file extension to use.

source

rtype:

Job

add_extension(extension)

Specify the file extension to use.

Examples

>>> b = Batch()
>>> j = b.new_job()
>>> j.command(f'echo "hello" > {j.ofile}')
>>> j.ofile.add_extension('.txt')
>>> b.run()

Notes

The default file name for a JobResourceFile is the name of the identifier.

Parameters:

extension (str) – File extension to use.

Return type:

JobResourceFile

Returns:

JobResourceFile – Same resource file with the extension specified

source()
Return type:

Job