-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
2,389 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# frozen_string_literal: true | ||
|
||
module API | ||
class SushiController < ApplicationController | ||
private | ||
|
||
## | ||
# We have encountered an error in their request, this might be an invalid date or a missing | ||
# required parameter. The end user can adjust the request and try again. | ||
# | ||
# @param [Exception] | ||
def render_sushi_exception(error) | ||
render json: error, status: 422 | ||
end | ||
rescue_from Sushi::Error::Exception, with: :render_sushi_exception | ||
|
||
public | ||
|
||
## | ||
# needs to include the following filters: begin & end date, item ID | ||
# | ||
# | ||
# When given an item_id parameter, filter the results to only that item_id. | ||
# | ||
# @note We should not need to find the record in ActiveFedora; hopefully we have all we need in | ||
# the stats database. | ||
def item_report | ||
@report = Sushi::ItemReport.new(params, account: current_account) | ||
render json: @report | ||
end | ||
|
||
def platform_report | ||
@report = Sushi::PlatformReport.new(params, account: current_account) | ||
render json: @report | ||
end | ||
|
||
def platform_usage | ||
@report = Sushi::PlatformUsageReport.new(params, account: current_account) | ||
render json: @report | ||
end | ||
|
||
def server_status | ||
@status = Sushi::ServerStatus.new(account: current_account).server_status | ||
render json: @status | ||
end | ||
|
||
def report_list | ||
@report = Sushi::ReportList.new | ||
render json: @report | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
# OVERRIDE Hyrax v3.6.0 | ||
# @see CreateLargeDerivativesJob | ||
module CreateDerivativesJobDecorator | ||
# OVERRIDE: Divert audio and video derivative | ||
# creation to CreateLargeDerivativesJob. | ||
def perform(file_set, file_id, filepath = nil) | ||
return super if is_a?(CreateLargeDerivativesJob) | ||
return super unless file_set.video? || file_set.audio? | ||
|
||
CreateLargeDerivativesJob.perform_later(*arguments) | ||
true | ||
end | ||
end | ||
|
||
CreateDerivativesJob.prepend(CreateDerivativesJobDecorator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
# CreateLargeDerivativesJob is intended to be used for resource-intensive derivative | ||
# generation (e.g. video processing). It is functionally similar to CreateDerivativesJob, | ||
# except that it queues jobs in the :auxiliary queue. | ||
# | ||
# The worker responsible for processing jobs in the :auxiliary queue should be | ||
# configured to have more resources dedicated to it, especially CPU. Otherwise, the | ||
# `ffmpeg` commands that this job class eventually triggers could be throttled. | ||
# | ||
# @see CreateDerivativesJobDecorator | ||
# @see Hydra::Derivatives::Processors::Ffmpeg | ||
# @see https://github.com/scientist-softserv/palni-palci/issues/852 | ||
class CreateLargeDerivativesJob < CreateDerivativesJob | ||
queue_as :auxiliary | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
class PruneStaleGuestUsersJob < ApplicationJob | ||
non_tenant_job | ||
repeat 'every week at 8am' # midnight PST | ||
|
||
def perform | ||
RolesService.prune_stale_guest_users | ||
end | ||
end |
Oops, something went wrong.