Skip to content

Commit 3181dab

Browse files
authored
feat: update job submission with 6.3 features (#28)
1 parent fecc042 commit 3181dab

File tree

12 files changed

+320
-55
lines changed

12 files changed

+320
-55
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
44

55
## UNRELEASED
66

7+
### Added
8+
9+
* The job submission APIs now support jobs with no time limit, and also can be used to submit jobs that trigger system image builds. (#28)
10+
711
### Fixed
812

913
* Fixed the submission of application-type jobs. (#31, #32, #33, #35)

docs/src/reference/job-submission.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ appbundle
243243
ComputeConfig
244244
submit_job
245245
Limit
246+
Unlimited
246247
WorkloadConfig
247248
```
248249

src/PackageBundler/PackageBundler.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ using Printf
77
using UUIDs
88
using Tar
99
using Glob
10+
import SHA
1011

1112
include("utils.jl")
1213

@@ -44,7 +45,7 @@ else
4445
end
4546

4647
"""
47-
bundle(dir; output = "", force=false, allownoenv=false, verbose = true)
48+
bundle(dir; output = "", force=false, allownoenv=false, verbose = true) -> String
4849
4950
Creates a `.tar` file with the contents of `dir` as well as
5051
any packages that are either tracked by path (developed) outside
@@ -55,8 +56,12 @@ be made available by adding it to `DEPOT_PATH`.
5556
5657
`.git` and [globs](https://en.wikipedia.org/wiki/Glob_(programming)) listed in
5758
`.juliabundleignore` are excluded form the bundle.
59+
60+
Returns the hex-encoded SHA256 of the `Manifest.toml` file that is packed into the appbundle.
61+
The return value is used when requesting a sysimage build, in which case we have to pass the
62+
manifest's hash with the submit request.
5863
"""
59-
function bundle(dir; output="", force=false, allownoenv=false, verbose=true)
64+
function bundle(dir; output="", force=false, allownoenv=false, verbose=true)::String
6065
if !isdir(dir)
6166
error("'$(dir)' is not a directory")
6267
end
@@ -112,6 +117,7 @@ function bundle(dir; output="", force=false, allownoenv=false, verbose=true)
112117
end
113118
end
114119
Pkg.Types.write_manifest(manifest, bundle_manifest)
120+
manifest_sha = bytes2hex(open(SHA.sha2_256, bundle_manifest))
115121
verbose && prettyprint("Archiving", "into $(repr(abspath(output_tar)))")
116122

117123
Tar.create(path_filterer(tmp_dir), tmp_dir, output_tar)
@@ -123,7 +129,7 @@ To run code on another machine:
123129
- Upload `$(output_tar)` to the machine and unpack it
124130
- Run `julia --project=$(name) -e 'push!(DEPOT_PATH, "$name/.bundle/depot"); import Pkg; Pkg.instantiate(); include("$name/main.jl"); main()'`""",
125131
)
126-
return nothing
132+
return manifest_sha
127133
end
128134

129135
function bundle_packages(ctx, dir, packages_tracked_pkg_server; verbose=true)

src/jobs/jobs.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,8 @@ end
552552
Extends the time limit of the job referred to by the [job reference `ref`](@ref JobReference) by
553553
`extension` (`Dates.Period`, or `Integer` number of hours). Returns an updated [`Job`](@ref) object.
554554
555-
See [`Limit`](@ref) for more information on how the `extension` argument is interpreted.
555+
See [`Limit`](@ref) for more information on how the `extension` argument is interpreted. Note that
556+
[`Unlimited`](@ref) is not allowed as `extension`.
556557
557558
See also: [`Job`](@ref).
558559
"""
@@ -562,6 +563,9 @@ extend_job(job::Job, extension::Limit; auth::Authentication=__auth__()) =
562563
extend_job(job.id, extension; auth=auth)
563564

564565
function extend_job(jobname::AbstractString, extension::Limit; auth::Authentication=__auth__())
566+
if extension isa Unlimited
567+
throw(ArgumentError("extension argument to extend_job can not be Unlimited"))
568+
end
565569
payload = JSON.json(
566570
Dict(
567571
"jobname" => jobname,

0 commit comments

Comments
 (0)