Skip to content

Commit 2823ee4

Browse files
authored
fix: submitting application jobs (#35)
1 parent ba66d96 commit 2823ee4

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66

77
### Fixed
88

9-
* Fixed the submission of application-type jobs. (#31, #32, #33)
9+
* Fixed the submission of application-type jobs. (#31, #32, #33, #35)
1010
* `JuliaHub.applications()` no longer throws a type error when the user has no registered and user applications. (#33)
1111

1212
## Version v0.1.4 - 2023-08-21

src/jobsubmission.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
struct _JobSubmission1
44
# User code & app configuration
55
appType::Union{String, Nothing} # defaults to 'batch'
6+
appArgs::Union{String, Nothing}
67
args::String
78
projectid::Union{String, Nothing}
89
## batch jobs
@@ -38,6 +39,7 @@ struct _JobSubmission1
3839
function _JobSubmission1(;
3940
# User code arguments
4041
appType::Union{AbstractString, Nothing}=nothing,
42+
appArgs::Union{Dict, Nothing}=nothing,
4143
args::Dict,
4244
projectid::Union{String, Nothing},
4345
customcode::Bool, usercode::Union{AbstractString, Nothing}=nothing,
@@ -104,10 +106,11 @@ struct _JobSubmission1
104106
)
105107
appbundle_upload_info = JSON.json(appbundle_upload_info)
106108
end
109+
appArgs = isnothing(appArgs) ? nothing : JSON.json(appArgs)
107110
# Create the _JobSubmission1 object
108111
new(
109112
# User code & app configuration
110-
appType, args, projectid,
113+
appType, appArgs, args, projectid,
111114
## batch job configuration
112115
string(customcode),
113116
usercode,
@@ -1012,6 +1015,7 @@ function submit_job(
10121015
else
10131016
c.env
10141017
end
1018+
args = merge(get(app, :args, Dict()), args)
10151019

10161020
projectid = isnothing(c.project) ? nothing : string(c.project)
10171021

@@ -1129,6 +1133,7 @@ function _job_submit_args(
11291133
)
11301134
return (;
11311135
appType=appjob.app._apptype,
1136+
appArgs=Dict("authentication" => true, "authorization" => "me"),
11321137
customcode=false,
11331138
# `jr_uuid` is set to associate the running job with the application icon in the UI
11341139
args=Dict("jobname" => appjob.app.name, "jr_uuid" => appjob.app._apptype),

test/jobs-applications-live.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# The JULIAHUBJL_LIVE_IDE_NAME can be used to override the default Julia
2+
# IDE name, should it change in the backend.
3+
DEFAULT_IDE_NAME = get(ENV, "JULIAHUBJL_LIVE_IDE_NAME", "Julia IDE")
4+
5+
@testset "[LIVE] Application job" begin
6+
default_ide = JuliaHub.application(:default, DEFAULT_IDE_NAME)
7+
job, _ = submit_test_job(default_ide; auth, alias=DEFAULT_IDE_NAME)
8+
@test occursin(DEFAULT_IDE_NAME, job.alias)
9+
job = wait_submission(job)
10+
@test job.status == "Running"
11+
job = JuliaHub.kill_job(job)
12+
job = JuliaHub.wait_job(job)
13+
@test job.status == "Stopped"
14+
end

test/runtests-live.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ JuliaHub.__AUTH__[] = auth
5656
include("jobs-live.jl")
5757
end
5858

59+
is_enabled("jobs-applications") &&
60+
@testset "JuliaHub Apps" begin
61+
include("jobs-applications-live.jl")
62+
end
63+
5964
is_enabled("jobs-windows") &&
6065
@testset "JuliaHub Jobs" begin
6166
include("jobs-windows-live.jl")

0 commit comments

Comments
 (0)