qa_server 7.2.0 → 7.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop_fixme.yml +6 -0
- data/.travis.yml +4 -5
- data/CHANGELOG.md +38 -0
- data/Rakefile +1 -1
- data/app/assets/stylesheets/qa_server/_check-status.scss +36 -0
- data/app/cache_processors/concerns/qa_server/cache_keys.rb +0 -5
- data/app/cache_processors/qa_server/cache_expiry_service.rb +13 -8
- data/app/cache_processors/qa_server/job_id_cache.rb +29 -0
- data/app/cache_processors/qa_server/performance_cache.rb +34 -34
- data/app/cache_processors/qa_server/performance_day_graph_cache.rb +27 -0
- data/app/cache_processors/qa_server/performance_month_graph_cache.rb +27 -0
- data/app/cache_processors/qa_server/performance_year_graph_cache.rb +27 -0
- data/app/cache_processors/qa_server/scenario_history_cache.rb +7 -7
- data/app/cache_processors/qa_server/scenario_history_graph_cache.rb +12 -17
- data/app/cache_processors/qa_server/scenario_run_cache.rb +8 -8
- data/app/cache_processors/qa_server/scenario_run_failures_cache.rb +7 -7
- data/app/cache_processors/qa_server/scenario_run_summary_cache.rb +7 -7
- data/app/controllers/concerns/qa_server/authority_validation_behavior.rb +49 -44
- data/app/controllers/qa_server/check_status_controller.rb +92 -22
- data/app/controllers/qa_server/fetch_controller.rb +36 -36
- data/app/controllers/qa_server/monitor_status_controller.rb +105 -105
- data/app/jobs/qa_server/history_graph_job.rb +28 -0
- data/app/jobs/qa_server/monitor_tests_job.rb +19 -39
- data/app/jobs/qa_server/performance_day_graph_job.rb +45 -0
- data/app/jobs/qa_server/performance_month_graph_job.rb +45 -0
- data/app/jobs/qa_server/performance_per_byte_job.rb +85 -0
- data/app/jobs/qa_server/performance_year_graph_job.rb +45 -0
- data/app/loggers/qa_server/scenario_logger.rb +74 -4
- data/app/models/concerns/qa_server/performance_history_data_keys.rb +8 -0
- data/app/models/qa_server/authority_scenario.rb +4 -4
- data/app/models/qa_server/authority_status.rb +2 -2
- data/app/models/qa_server/authority_status_failure.rb +1 -1
- data/app/models/qa_server/performance_history.rb +2 -2
- data/app/models/qa_server/scenario_run_history.rb +52 -52
- data/app/models/qa_server/scenario_run_registry.rb +2 -2
- data/app/models/qa_server/scenarios.rb +26 -26
- data/app/models/qa_server/search_scenario.rb +18 -13
- data/app/models/qa_server/term_scenario.rb +29 -29
- data/app/prepends/prepended_linked_data/find_term.rb +40 -40
- data/app/prepends/prepended_linked_data/search_query.rb +36 -36
- data/app/prepends/prepended_rdf/rdf_graph.rb +7 -7
- data/app/presenters/concerns/qa_server/monitor_status/performance_datatable_behavior.rb +32 -32
- data/app/presenters/concerns/qa_server/monitor_status/performance_graph_behavior.rb +64 -64
- data/app/presenters/qa_server/check_status_presenter.rb +63 -7
- data/app/services/concerns/qa_server/gruff_graph.rb +16 -16
- data/app/services/qa_server/authority_loader_service.rb +14 -14
- data/app/services/qa_server/authority_validator_service.rb +1 -0
- data/app/services/qa_server/database_migrator.rb +14 -14
- data/app/services/qa_server/history_graphing_service.rb +30 -30
- data/app/services/qa_server/performance_calculator_service.rb +80 -80
- data/app/services/qa_server/performance_datatable_service.rb +35 -35
- data/app/services/qa_server/performance_graph_data_service.rb +28 -28
- data/app/services/qa_server/performance_graphing_service.rb +58 -58
- data/app/services/qa_server/performance_per_byte_calculator_service.rb +88 -0
- data/app/services/qa_server/performance_per_byte_data_service.rb +41 -0
- data/app/services/qa_server/scenarios_loader_service.rb +1 -1
- data/app/services/qa_server/time_period_service.rb +21 -21
- data/app/validators/qa_server/scenario_validator.rb +99 -87
- data/app/validators/qa_server/search_scenario_validator.rb +67 -61
- data/app/validators/qa_server/term_scenario_validator.rb +20 -15
- data/app/views/qa_server/check_status/index.html.erb +120 -24
- data/config/i18n-tasks.yml +133 -0
- data/config/locales/qa_server.en.yml +15 -0
- data/lib/generators/qa_server/assets_generator.rb +4 -4
- data/lib/generators/qa_server/templates/config/authorities/linked_data/cerl_ld4l_cache.json +2 -2
- data/lib/generators/qa_server/templates/config/authorities/linked_data/getty_aat_ld4l_cache.json +62 -1
- data/lib/generators/qa_server/templates/config/authorities/linked_data/getty_tgn_ld4l_cache.json +28 -4
- data/lib/generators/qa_server/templates/config/authorities/linked_data/isni_ld4l_cache.json +90 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/ligatus_ld4l_cache.json +133 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/locnames_rwo2_ld4l_cache.json +248 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/locnames_rwo3_ld4l_cache.json +248 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/locvocabs_ld4l_cache.json +117 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/mesh_nlm_ld4l_cache.json +135 -3
- data/lib/generators/qa_server/templates/config/authorities/linked_data/oclcfast_direct.json +1 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/oclcfast_ld4l_cache.json +1 -4
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/agrovoc_direct_validation.yml +31 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/agrovoc_ld4l_cache_validation.yml +31 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/cerl_ld4l_cache_validation.yml +23 -11
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/dbpedia_ld4l_cache_validation.yml +33 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/geonames_direct_validation.yml +35 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/geonames_ld4l_cache_validation.yml +58 -5
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/getty_aat_ld4l_cache_validation.yml +256 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/getty_tgn_ld4l_cache_validation.yml +35 -1
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/getty_ulan_ld4l_cache_validation.yml +37 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/isni_ld4l_cache_validation.yml +10 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/ligatus_ld4l_cache_validation.yml +36 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locdemographics_ld4l_cache_validation.yml +73 -44
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locgenres_ld4l_cache_validation.yml +31 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locnames_ld4l_cache_validation.yml +71 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locnames_rwo_ld4l_cache_validation.yml +70 -2
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locperformance_ld4l_cache_validation.yml +6 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locsubjects_ld4l_cache_validation.yml +32 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locvocabs_ld4l_cache_validation.yml +184 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/mesh_nlm_ld4l_cache_validation.yml +51 -1
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/nalt_ld4l_cache_validation.yml +37 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/oclc_fast_validation.yml +71 -5
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/oclcfast_direct_validation.yml +66 -1
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/oclcfast_ld4l_cache_validation.yml +57 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/rda_registry_ld4l_cache_validation.yml +310 -0
- data/lib/qa_server/configuration.rb +28 -24
- data/lib/qa_server/version.rb +1 -1
- data/qa_server.gemspec +2 -1
- data/spec/feature/accuracy_spec.rb +32 -0
- data/spec/i18n_spec.rb +36 -0
- data/spec/spec_helper.rb +4 -0
- metadata +46 -12
- data/app/cache_processors/qa_server/performance_daily_graph_cache.rb +0 -60
- data/app/cache_processors/qa_server/performance_hourly_graph_cache.rb +0 -65
- data/app/cache_processors/qa_server/performance_monthly_graph_cache.rb +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8c0138684332f934add8000e85d76c86264162963e7df49fa170ee894783aa17
|
4
|
+
data.tar.gz: 2f9e19975f53fa4e0d34feb8e4423f203e0d46bafe6bc30af614459256a6b66f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd9de3a942001f3e6eca2790441fa2ea2f8d386033c4af93cca230ac2ee3dbb357d44378535bdf521a89e196d29b6fd7308b1f1a6246ece9c1293c6c521deb7d
|
7
|
+
data.tar.gz: 933c7742a774144186e9a63f749a2b4d01c89c76b7849d8c18419e0ea95d0df28158ce5286ca694d516fa994f14796c8f668708e907ca2c037e880b101afc5e9
|
data/.rubocop_fixme.yml
CHANGED
data/.travis.yml
CHANGED
@@ -13,9 +13,9 @@ before_install:
|
|
13
13
|
- google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=9222 http://localhost &
|
14
14
|
|
15
15
|
rvm:
|
16
|
-
- 2.
|
17
|
-
- 2.
|
18
|
-
- 2.
|
16
|
+
- 2.5.8
|
17
|
+
- 2.6.6
|
18
|
+
- 2.7.1
|
19
19
|
|
20
20
|
env:
|
21
21
|
global:
|
@@ -26,8 +26,7 @@ env:
|
|
26
26
|
# It should be sufficient to test only the latest of the patch versions for a minor version, they
|
27
27
|
# should be compatible across patch versions (only bug fixes are released in patch versions).
|
28
28
|
matrix:
|
29
|
-
- "RAILS_VERSION=5.
|
30
|
-
- "RAILS_VERSION=5.2.3"
|
29
|
+
- "RAILS_VERSION=5.2.4"
|
31
30
|
|
32
31
|
services:
|
33
32
|
- redis-server
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,41 @@
|
|
1
|
+
### 7.5.1 (2020-12-08)
|
2
|
+
|
3
|
+
* define missing i18n translations
|
4
|
+
* add i18n-tasks gem for managing translations
|
5
|
+
* add spec test to check for missing translations
|
6
|
+
|
7
|
+
### 7.5.0 (2020-12-07)
|
8
|
+
|
9
|
+
* UI improvements of check_status page
|
10
|
+
* pre-populate selection fields with most recently submitted authorities
|
11
|
+
* add ability to compare two authorities' accuracy tests in UI
|
12
|
+
* update check_status UI to require GO button click to start processing
|
13
|
+
* fix javascript to avoid referencing missing elements
|
14
|
+
* accuracy test updates
|
15
|
+
* accuracy tests default to `context=false` since it is not required for testing
|
16
|
+
* allow accuracy tests through rspec to be marked pending (allows for better regression testing)
|
17
|
+
* add pending to failing validation tests such that accuracy_spec passes
|
18
|
+
* sync tests with production accuracy tests
|
19
|
+
* fix typo in `position` and a few syntax errors
|
20
|
+
* adjust result_size for validations where passing tests return less than 200 chars
|
21
|
+
* split locnames_rwo_ld4l_cache into 3 sets of tests of about 9 each to avoid time out
|
22
|
+
* add extended context for getty_aat_ld4l_cache and getty_tgn_ld4l_cache
|
23
|
+
* add authority locvocabs_ld4l_cache
|
24
|
+
* add request_data to status_logger (e.g. query for search, identifier for term)
|
25
|
+
* update to latest bixby v3.0
|
26
|
+
|
27
|
+
### 7.4.0 (2020-04-13)
|
28
|
+
|
29
|
+
* add size and complexity performance statistics (not auto-generated)
|
30
|
+
|
31
|
+
### 7.3.0 (2020-04-08)
|
32
|
+
|
33
|
+
* move generation of graphs to background jobs
|
34
|
+
|
35
|
+
### 7.2.1 (2020-02-23)
|
36
|
+
|
37
|
+
* fix graph fails generation when any label is empty string
|
38
|
+
|
1
39
|
### 7.2.0 (2020-02-22)
|
2
40
|
|
3
41
|
* move graphs from assets to public directory
|
data/Rakefile
CHANGED
@@ -25,6 +25,23 @@ div#example-url-warning {
|
|
25
25
|
color: #4d0000;
|
26
26
|
}
|
27
27
|
|
28
|
+
div#authority-selector {
|
29
|
+
margin-top: 20px;
|
30
|
+
margin-bottom: 0px;
|
31
|
+
margin-left: 20px;
|
32
|
+
margin-right: 20px;
|
33
|
+
width: 40%;
|
34
|
+
}
|
35
|
+
|
36
|
+
div#comparison-authority-selector {
|
37
|
+
display: none;
|
38
|
+
margin-top: 20px;
|
39
|
+
margin-bottom: 0px;
|
40
|
+
margin-left: 20px;
|
41
|
+
margin-right: 20px;
|
42
|
+
width: 40%;
|
43
|
+
}
|
44
|
+
|
28
45
|
div.status-section {
|
29
46
|
margin-top: 50px;
|
30
47
|
}
|
@@ -43,6 +60,20 @@ table, th, td {
|
|
43
60
|
padding: 5px;
|
44
61
|
}
|
45
62
|
|
63
|
+
th.comparison-header {
|
64
|
+
background-color: #2e2c2c;
|
65
|
+
}
|
66
|
+
|
67
|
+
th.comparison-before {
|
68
|
+
text-align: center;
|
69
|
+
color: #f4f360;
|
70
|
+
}
|
71
|
+
|
72
|
+
th.comparison-after {
|
73
|
+
text-align: center;
|
74
|
+
color: #7df34c;
|
75
|
+
}
|
76
|
+
|
46
77
|
th {
|
47
78
|
background-color: #a1b1c4;
|
48
79
|
color: black;
|
@@ -52,6 +83,11 @@ td.position {
|
|
52
83
|
text-align: center;
|
53
84
|
}
|
54
85
|
|
86
|
+
th.bold-left-border,
|
87
|
+
td.bold-left-border {
|
88
|
+
border-left: 2px solid black;
|
89
|
+
}
|
90
|
+
|
55
91
|
.status-good {
|
56
92
|
text-align: center;
|
57
93
|
background-color: #ccffcc;
|
@@ -2,15 +2,10 @@
|
|
2
2
|
# This module sets up the keys used to identify data in Rails.cache
|
3
3
|
module QaServer
|
4
4
|
module CacheKeys
|
5
|
-
SCENARIO_RUN_TEST_DATA_CACHE_KEY = "QaServer--CacheKeys--scenario_run_test_data"
|
6
5
|
SCENARIO_RUN_SUMMARY_DATA_CACHE_KEY = "QaServer--CacheKeys--scenario_run_summary_data"
|
7
6
|
SCENARIO_RUN_FAILURE_DATA_CACHE_KEY = "QaServer--CacheKeys--scenario_run_failure_data"
|
8
7
|
SCENARIO_RUN_HISTORY_DATA_CACHE_KEY = "QaServer--CacheKeys--scenario_run_history_data"
|
9
|
-
SCENARIO_RUN_HISTORY_GRAPH_CACHE_KEY = "QaServer--CacheKeys--scenario_run_history_graph"
|
10
8
|
|
11
9
|
PERFORMANCE_DATATABLE_DATA_CACHE_KEY = "QaServer--Cache--performance_datatable_data"
|
12
|
-
PERFORMANCE_GRAPH_HOURLY_DATA_CACHE_KEY = "QaServer--CacheKeys--performance_graph_hourly_data"
|
13
|
-
PERFORMANCE_GRAPH_DAILY_DATA_CACHE_KEY = "QaServer--CacheKeys--performance_graph_daily_data"
|
14
|
-
PERFORMANCE_GRAPH_MONTHLY_DATA_CACHE_KEY = "QaServer--CacheKeys--performance_graph_monthly_data"
|
15
10
|
end
|
16
11
|
end
|
@@ -8,6 +8,11 @@ module QaServer
|
|
8
8
|
cache_expires_at - QaServer::TimeService.current_time
|
9
9
|
end
|
10
10
|
|
11
|
+
def end_of_hour_expiry
|
12
|
+
ct = QaServer::TimeService.current_time
|
13
|
+
ct.end_of_hour - ct
|
14
|
+
end
|
15
|
+
|
11
16
|
# @param key [String] cache key
|
12
17
|
# @param force [Boolean] if true, forces cache to regenerate by returning true; otherwise, uses cache expiry to determine whether cache has expired
|
13
18
|
# @return [Boolean] true if cache has expired or is being forced to expire
|
@@ -19,15 +24,15 @@ module QaServer
|
|
19
24
|
force
|
20
25
|
end
|
21
26
|
|
22
|
-
|
27
|
+
private
|
23
28
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
# @return [ActiveSupport::TimeWithZone] DateTime at which cache should expire
|
30
|
+
def cache_expires_at
|
31
|
+
offset = QaServer.config.hour_offset_to_expire_cache
|
32
|
+
offset_time = QaServer::TimeService.current_time
|
33
|
+
offset_time = offset_time.tomorrow unless (offset_time + 5.minutes).hour < offset
|
34
|
+
offset_time.beginning_of_day + offset.hours - 5.minutes
|
35
|
+
end
|
31
36
|
end
|
32
37
|
end
|
33
38
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Provide service methods for getting a list of all authorities and scenarios for an authority.
|
3
|
+
module QaServer
|
4
|
+
class JobIdCache
|
5
|
+
class << self
|
6
|
+
# Is the passed in job_id the active one for the job_key?
|
7
|
+
# @param job_key [String] key unique to the job being run (e.g. "QaServer::Jobs::MonitorTestsJob")
|
8
|
+
# @param job_id [String] UUID for job running the tests
|
9
|
+
# @param expires_in [ActiveSupport::Duration] This should be at least as long as the expected job run time to avoid multiple instances of the job running at the same time.
|
10
|
+
# @note When job completes, call reset_job_id to invalidate the cache
|
11
|
+
def active_job_id?(job_key:, job_id:, expires_in: 30.minutes)
|
12
|
+
cached_job_id = Rails.cache.fetch(cache_key(job_key), expires_in: expires_in, race_condition_ttl: 5.minutes) { job_id }
|
13
|
+
cached_job_id == job_id
|
14
|
+
end
|
15
|
+
|
16
|
+
# Delete cache for job id for the job represented by job_key. Call this when the job completes.
|
17
|
+
# @param job_key [String] key unique to the job being run (e.g. "QaServer::Jobs::MonitorTestsJob")
|
18
|
+
def reset_job_id(job_key:)
|
19
|
+
Rails.cache.delete(cache_key(job_key))
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def cache_key(job_key)
|
25
|
+
"#{job_key}-job_id"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -49,45 +49,45 @@ module QaServer
|
|
49
49
|
cache_to_write = nil # free cache for garbage collection
|
50
50
|
end
|
51
51
|
|
52
|
-
|
52
|
+
private
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
def swap_cache_hash
|
55
|
+
cache_to_write = @cache
|
56
|
+
@cache = {} # reset main cache so new items after write begins are cached in the main cache
|
57
|
+
QaServer.config.performance_cache_logger.debug("#{self.class}##{__method__} - cache memory BEFORE write: #{ObjectSpace.memsize_of(cache_to_write)}")
|
58
|
+
cache_to_write
|
59
|
+
end
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
61
|
+
def log(id:)
|
62
|
+
return if QaServer.config.suppress_logging_performance_datails?
|
63
|
+
Rails.logger.debug("*** performance data for id: #{id} ***")
|
64
|
+
Rails.logger.debug(@cache[id].to_yaml)
|
65
|
+
end
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
def incomplete?(entry)
|
68
|
+
required_keys.each { |k| return true unless entry.key? k }
|
69
|
+
false
|
70
|
+
end
|
71
71
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
72
|
+
def required_keys
|
73
|
+
[:dt_stamp,
|
74
|
+
:authority,
|
75
|
+
:action,
|
76
|
+
:action_time_ms,
|
77
|
+
:size_bytes,
|
78
|
+
:retrieve_time_ms,
|
79
|
+
:graph_load_time_ms,
|
80
|
+
:normalization_time_ms]
|
81
|
+
end
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
90
|
-
QaServer.config.performance_cache_logger.debug("#{prefix} - cache memory AFTER write: #{ObjectSpace.memsize_of @cache}")
|
83
|
+
def log_write_all(prefix, size_before, cache_size)
|
84
|
+
if size_before.positive?
|
85
|
+
QaServer.config.performance_cache_logger.debug("#{prefix} 0 of #{size_before} performance data records were saved") if size_before == cache_size
|
86
|
+
QaServer.config.performance_cache_logger.debug("#{prefix} #{size_before - cache_size} of #{size_before} performance data records were saved") if size_before > cache_size
|
87
|
+
else
|
88
|
+
QaServer.config.performance_cache_logger.debug("#{prefix} 0 of 0 performance data records were saved")
|
91
89
|
end
|
90
|
+
QaServer.config.performance_cache_logger.debug("#{prefix} - cache memory AFTER write: #{ObjectSpace.memsize_of @cache}")
|
91
|
+
end
|
92
92
|
end
|
93
93
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Cache the datetime_stamp of the last time the performance day graph was generated. Calls job to generate the graph if expired.
|
3
|
+
module QaServer
|
4
|
+
class PerformanceDayGraphCache
|
5
|
+
class << self
|
6
|
+
# Generates graphs for the past 24 hours for :search, :fetch, and :all actions for each authority.
|
7
|
+
# @param force [Boolean] if true, run the tests even if the cache hasn't expired; otherwise, use cache if not expired
|
8
|
+
def generate_graphs(force: false)
|
9
|
+
Rails.cache.fetch(cache_key, expires_in: next_expiry, race_condition_ttl: 30.seconds, force: force) do
|
10
|
+
QaServer.config.monitor_logger.debug("(QaServer::PerformanceDayGraphCache) - KICKING OFF PERFORMANCE DAY GRAPH GENERATION (force: #{force})")
|
11
|
+
QaServer::PerformanceDayGraphJob.perform_later
|
12
|
+
"Graphs generation initiated at #{QaServer::TimeService.current_time}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def cache_key
|
19
|
+
"QaServer::PerformanceDayGraphCache.generate_graphs--latest_generation_initiated"
|
20
|
+
end
|
21
|
+
|
22
|
+
def next_expiry
|
23
|
+
QaServer::CacheExpiryService.end_of_hour_expiry
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Cache the datetime_stamp of the last time the performance month graph was generated. Calls job to generate the graph if expired.
|
3
|
+
module QaServer
|
4
|
+
class PerformanceMonthGraphCache
|
5
|
+
class << self
|
6
|
+
# Generates graphs for the past 30 days for :search, :fetch, and :all actions for each authority.
|
7
|
+
# @param force [Boolean] if true, run the tests even if the cache hasn't expired; otherwise, use cache if not expired
|
8
|
+
def generate_graphs(force: false)
|
9
|
+
Rails.cache.fetch(cache_key, expires_in: next_expiry, race_condition_ttl: 30.seconds, force: force) do
|
10
|
+
QaServer.config.monitor_logger.debug("(QaServer::PerformanceMonthGraphCache) - KICKING OFF PERFORMANCE MONTH GRAPH GENERATION (force: #{force})")
|
11
|
+
QaServer::PerformanceMonthGraphJob.perform_later
|
12
|
+
"Graphs generation initiated at #{QaServer::TimeService.current_time}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def cache_key
|
19
|
+
"QaServer::PerformanceMonthGraphCache.generate_graphs--latest_generation_initiated"
|
20
|
+
end
|
21
|
+
|
22
|
+
def next_expiry
|
23
|
+
QaServer::CacheExpiryService.cache_expiry
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Cache the datetime_stamp of the last time the performance year graph was generated. Calls job to generate the graph if expired.
|
3
|
+
module QaServer
|
4
|
+
class PerformanceYearGraphCache
|
5
|
+
class << self
|
6
|
+
# Generates graphs for the 12 months for :search, :fetch, and :all actions for each authority.
|
7
|
+
# @param force [Boolean] if true, run the tests even if the cache hasn't expired; otherwise, use cache if not expired
|
8
|
+
def generate_graphs(force: false)
|
9
|
+
Rails.cache.fetch(cache_key, expires_in: next_expiry, race_condition_ttl: 30.seconds, force: force) do
|
10
|
+
QaServer.config.monitor_logger.debug("(QaServer::PerformanceYearGraphCache) - KICKING OFF PERFORMANCE YEAR GRAPH GENERATION (force: #{force})")
|
11
|
+
QaServer::PerformanceYearGraphJob.perform_later
|
12
|
+
"Graphs generation initiated at #{QaServer::TimeService.current_time}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def cache_key
|
19
|
+
"QaServer::PerformanceYearGraphCache.generate_graphs--latest_generation_initiated"
|
20
|
+
end
|
21
|
+
|
22
|
+
def next_expiry
|
23
|
+
QaServer::CacheExpiryService.cache_expiry
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -21,15 +21,15 @@ module QaServer
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
private
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
def cache_key_for_historical_data
|
27
|
+
SCENARIO_RUN_HISTORY_DATA_CACHE_KEY
|
28
|
+
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
def next_expiry
|
31
|
+
QaServer::CacheExpiryService.cache_expiry
|
32
|
+
end
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -2,31 +2,26 @@
|
|
2
2
|
# Generate graphs for the past 30 days using cached data. Graphs are generated only if the cache has expired.
|
3
3
|
module QaServer
|
4
4
|
class ScenarioHistoryGraphCache
|
5
|
-
class_attribute :graphing_service
|
6
|
-
self.graphing_service = QaServer::HistoryGraphingService
|
7
|
-
|
8
5
|
class << self
|
9
|
-
include QaServer::CacheKeys
|
10
|
-
|
11
|
-
HISTORICAL_GRAPH_FILENAME = 'historical_side_stacked_bar.png'
|
12
|
-
|
13
6
|
# Generates graphs for the past 30 days for :search, :fetch, and :all actions for each authority.
|
14
7
|
# @param force [Boolean] if true, run the tests even if the cache hasn't expired; otherwise, use cache if not expired
|
15
8
|
def generate_graph(data:, force: false)
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
Rails.cache.fetch(cache_key, expires_in: next_expiry, race_condition_ttl: 30.seconds, force: force) do
|
10
|
+
QaServer.config.monitor_logger.debug("(QaServer::ScenarioHistoryGraphCache) - KICKING OFF HISTORY GRAPH GENERATION (force: #{force})")
|
11
|
+
QaServer::HistoryGraphJob.perform_later(data: data)
|
12
|
+
"Graph generation initiated at #{QaServer::TimeService.current_time}"
|
13
|
+
end
|
19
14
|
end
|
20
15
|
|
21
|
-
|
16
|
+
private
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
def cache_key
|
19
|
+
"QaServer::ScenarioHistoryGraphCache.generate_graph--latest_generation_initiated"
|
20
|
+
end
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
def next_expiry
|
23
|
+
QaServer::CacheExpiryService.cache_expiry
|
24
|
+
end
|
30
25
|
end
|
31
26
|
end
|
32
27
|
end
|