Skip to content

Commit 1a1c5a6

Browse files
authored
chore: fix Julia formatting (#54)
1 parent ad5d0fb commit 1a1c5a6

19 files changed

+50
-50
lines changed

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Mocking.apply(mocking_patch) do
6464
authors="JuliaHub Inc.",
6565
format=Documenter.HTML(;
6666
canonical="https://help.juliahub.com/julia-api/stable",
67-
edit_link="main"
67+
edit_link="main",
6868
),
6969
pages=[
7070
"Home" => "index.md",

src/authentication.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function authenticate(
202202
server_uri_string = if isnothing(server)
203203
haskey(ENV, "JULIA_PKG_SERVER") || throw(
204204
AuthenticationError(
205-
"Either JULIA_PKG_SERVER must be set, or explicit `server` argument passed to JuliaHub.authenticate().",
205+
"Either JULIA_PKG_SERVER must be set, or explicit `server` argument passed to JuliaHub.authenticate()."
206206
),
207207
)
208208
Pkg.pkg_server()
@@ -442,7 +442,7 @@ function reauthenticate!(
442442
if new_auth.username != auth.username
443443
throw(
444444
AuthenticationError(
445-
"Username in new authentication ($(new_auth.username)) does not match original authentication ($(auth.username))",
445+
"Username in new authentication ($(new_auth.username)) does not match original authentication ($(auth.username))"
446446
),
447447
)
448448
end

src/datasets.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ function datasets(
317317
e isa JuliaHubException && rethrow(e)
318318
e isa JuliaHubError && rethrow(e)
319319
throw(
320-
JuliaHubError("Error while retrieving datasets from the server", e, catch_backtrace()),
320+
JuliaHubError("Error while retrieving datasets from the server", e, catch_backtrace())
321321
)
322322
end
323323
# It might happen that some of the elements of the `datasets` array can not be parsed for some reason,
@@ -406,7 +406,7 @@ function dataset end
406406
@_authuser function dataset(
407407
dsref::_DatasetRefTuple;
408408
throw::Bool=true,
409-
auth::Authentication=__auth__()
409+
auth::Authentication=__auth__(),
410410
)
411411
username, dataset_name = dsref
412412
for dataset in datasets(; shared=true, auth)
@@ -447,7 +447,7 @@ function delete_dataset end
447447
@_authuser function delete_dataset(
448448
dsref::_DatasetRefTuple;
449449
force::Bool=false,
450-
auth::Authentication=__auth__()
450+
auth::Authentication=__auth__(),
451451
)
452452
username, dataset_name = dsref
453453
_assert_current_user(username, auth; op="delete_dataset")
@@ -548,7 +548,7 @@ function upload_dataset end
548548
# we must throw an invalid request error.
549549
throw(
550550
InvalidRequestError(
551-
"Dataset '$dataset_name' for user '$username' already exists, but update=false and replace=false.",
551+
"Dataset '$dataset_name' for user '$username' already exists, but update=false and replace=false."
552552
),
553553
)
554554
elseif replace
@@ -600,7 +600,7 @@ function upload_dataset end
600600
# dtype).
601601
throw(
602602
InvalidRequestError(
603-
"Local data type ($dtype) does not match existing dataset dtype $(upload_config["dataset_type"])",
603+
"Local data type ($dtype) does not match existing dataset dtype $(upload_config["dataset_type"])"
604604
),
605605
)
606606
end
@@ -622,7 +622,7 @@ function upload_dataset end
622622
if !all(ismissing.((description, tags, visibility, license, groups)))
623623
update_dataset(
624624
(username, dataset_name); auth,
625-
description, tags, visibility, license, groups
625+
description, tags, visibility, license, groups,
626626
)
627627
end
628628
# If everything was successful, we'll return an updated DataSet object.
@@ -843,7 +843,7 @@ function download_dataset(
843843
dsref::_DatasetRefTuple,
844844
local_path::AbstractString;
845845
auth::Authentication=__auth__(),
846-
kwargs...
846+
kwargs...,
847847
)
848848
ds = dataset(dsref; auth)
849849
download_dataset(ds, local_path; auth, kwargs...)
@@ -858,7 +858,7 @@ function download_dataset(
858858
)
859859
dataset.dtype ["Blob", "BlobTree"] || throw(
860860
InvalidRequestError(
861-
"Download only supported for Blobs and BlobTrees, but '$(dataset.name)' is $(dataset.type)",
861+
"Download only supported for Blobs and BlobTrees, but '$(dataset.name)' is $(dataset.type)"
862862
),
863863
)
864864

src/jobs/jobs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ function _download_job_file(auth::Authentication, file::JobFile, io::IO)
511511
job_file_url,
512512
_authheaders(auth);
513513
status_exception=false,
514-
response_stream=io
514+
response_stream=io,
515515
)
516516
r.status == 200 || _throw_invalidresponse(r)
517517
return nothing

src/jobs/logging-kafka.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ mutable struct KafkaLogsBuffer <: AbstractJobLogsBuffer
7171
f,
7272
nothing,
7373
0,
74-
ReentrantLock()
74+
ReentrantLock(),
7575
)
7676
# If the user requested streaming too, then we start the background task.
7777
stream && _job_logs_kafka_start_streaming!(auth, b)
@@ -142,7 +142,7 @@ function _job_logs_newer!(
142142
consumer_id, logs, job_is_done = _get_logs_kafka_parsed(
143143
auth, jobname;
144144
offset=_kafka_next_offset(b),
145-
timeout=_KAFKA_DEFAULT_GET_TIMEOUT
145+
timeout=_KAFKA_DEFAULT_GET_TIMEOUT,
146146
)
147147
job_is_done && (b._found_last = true)
148148
# If the returned list of logs is empty, we check if we can still update the cursor
@@ -176,7 +176,7 @@ function _job_logs_newer!(
176176
next_offset = last(logs)._offset + 1
177177
consumer_id, logs, job_is_done = _get_logs_kafka_parsed(
178178
auth, jobname; offset=next_offset, consumer_id,
179-
timeout=_KAFKA_DEFAULT_GET_TIMEOUT
179+
timeout=_KAFKA_DEFAULT_GET_TIMEOUT,
180180
)
181181
job_is_done && (b._found_last = true)
182182
end
@@ -257,7 +257,7 @@ function _job_logs_older!(
257257
consumer_id, logs, _ = _get_logs_kafka_parsed(
258258
auth, jobname;
259259
offset=next_offset,
260-
timeout=_KAFKA_DEFAULT_GET_TIMEOUT
260+
timeout=_KAFKA_DEFAULT_GET_TIMEOUT,
261261
)
262262
# This should not normally happen because we should only be asking for logs that are actually present.
263263
# But sometimes it does.. maybe when the timeout is not long enough? So we handle this by gracefully
@@ -278,7 +278,7 @@ function _job_logs_older!(
278278
next_offset = last(logs)._offset + 1
279279
consumer_id, logs, _ = _get_logs_kafka_parsed(
280280
auth, jobname; offset=next_offset, consumer_id,
281-
timeout=_KAFKA_DEFAULT_GET_TIMEOUT
281+
timeout=_KAFKA_DEFAULT_GET_TIMEOUT,
282282
)
283283
@assert !isempty(logs)
284284
end

src/jobs/logging-legacy.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function _get_job_logs_legacy(
188188
query = Pair{String, Any}[
189189
"log_output_type" => "content",
190190
"jobname" => jobname,
191-
"log_out_type" => "json"
191+
"log_out_type" => "json",
192192
]
193193
if start_time !== nothing
194194
if end_time !== nothing
@@ -224,7 +224,7 @@ function _get_job_logs_legacy(
224224
if jb isa Dict && !get(jb, "success", true)
225225
throw(
226226
JuliaHubError(
227-
"Downloading log content failed: `$(get(jb, "reason", get(jb, "message", "unknown error")))`",
227+
"Downloading log content failed: `$(get(jb, "reason", get(jb, "message", "unknown error")))`"
228228
),
229229
)
230230
end
@@ -461,7 +461,7 @@ function _job_logs_older!(
461461
r = JuliaHub._get_job_logs_legacy(
462462
auth, jobname;
463463
end_time=timestamp,
464-
event_id=reference_log._legacy_eventId
464+
event_id=reference_log._legacy_eventId,
465465
)
466466
if isempty(r.logs)
467467
# TODO: If the logs are empty, then something has probably gone wrong

src/jobs/logging.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ end
6464
_print_log_list(logs::Vector{JobLogMessage}; kwargs...) = _print_log_list(stdout, logs; kwargs...)
6565
function _print_log_list(
6666
io::IO, logs::Vector{JobLogMessage}; all::Bool=false,
67-
nlines::Integer=_default_display_lines(io)
67+
nlines::Integer=_default_display_lines(io),
6868
)
6969
@assert Base.all(x -> isa(x, JobLogMessage), logs) # note: kwarg shadows function
7070
@assert nlines >= 1

src/jobsubmission.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ function _upload_appbundle(appbundle_tar_path::AbstractString; auth::Authenticat
785785
Mocking.@mock _restput_mockable(
786786
upload_url,
787787
["Content-Length" => filesize(appbundle_tar_path)],
788-
input
788+
input,
789789
)
790790
end
791791
# The response body of a successful upload is empty
@@ -1136,7 +1136,7 @@ function submit_job(
11361136
end
11371137
submit_job(
11381138
WorkloadConfig(app, compute; alias, env, project, timelimit, _image_sha256);
1139-
kwargs...
1139+
kwargs...,
11401140
)
11411141
end
11421142

@@ -1290,7 +1290,7 @@ function _job_submit_args(
12901290
registry_name=packagejob.registry,
12911291
args=merge(
12921292
Dict("jobname" => packagejob.name, "jr_uuid" => packagejob.jr_uuid),
1293-
packagejob.args
1293+
packagejob.args,
12941294
),
12951295
# Just in case, we want to omit sysimage_build altogether when it is not requested.
12961296
sysimage_build=packagejob.sysimage ? true : nothing,

src/node.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ function _nodespec_exact(
170170
if isempty(idxs)
171171
return _throw_or_nothing(;
172172
msg="Unable to find a nodespec: ncpu=$ncpu memory=$memory gpu=$gpu",
173-
throw
173+
throw,
174174
)
175175
end
176176
if length(idxs) > 1
@@ -192,7 +192,7 @@ function _nodespec_smallest(
192192
if isnothing(idx)
193193
return _throw_or_nothing(;
194194
msg="Unable to find a nodespec with at least: ncpu=$ncpu memory=$memory gpu=$gpu",
195-
throw
195+
throw,
196196
)
197197
else
198198
return nodes[idx]

src/userinfo.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function _get_authenticated_user_legacy(server::AbstractString, token::Secret)::
4444
json, _ = _parse_response_json(r, Dict)
4545
users = _get_json(_get_json(json, "data", Dict; msg), "users", Vector)
4646
length(users) == 1 || throw(
47-
JuliaHubError("$msg\nInvalid JSON returned by the server: length(users)=$(length(users))"),
47+
JuliaHubError("$msg\nInvalid JSON returned by the server: length(users)=$(length(users))")
4848
)
4949
user = only(users)
5050
userid = _get_json(user, "id", Int; msg)

0 commit comments

Comments
 (0)