-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_unlock.rb
More file actions
102 lines (86 loc) · 3.44 KB
/
debug_unlock.rb
File metadata and controls
102 lines (86 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
project = Project.find(69560)
puts "=== Debugging unlock logic for project #{project.id} ===\n"
# Get docker image
asap_docker_image = Basic.get_asap_docker(project.version)
puts "Docker image ID: #{asap_docker_image.id}\n\n"
# Get steps hash
h_steps = {}
Step.all.each { |s| h_steps[s.id] = s }
# Get all annotations
all_annots = Annot.where(project_id: project.id).includes(:run).all
puts "Total annotations in project: #{all_annots.count}\n\n"
# Check gene_filtering
gene_filtering_step = Step.where(docker_image_id: asap_docker_image.id, name: 'gene_filtering').first
if gene_filtering_step
puts "=== GENE_FILTERING STEP (#{gene_filtering_step.id}) ===\n"
std_methods = StdMethod.where(docker_image_id: asap_docker_image.id, step_id: gene_filtering_step.id, obsolete: false).all
puts "StdMethods: #{std_methods.count}\n"
if std_methods.empty?
puts "NO STD_METHODS - Should be unlocked: YES\n\n"
else
std_methods.each do |m|
puts "\nStdMethod #{m.id} (#{m.name}):"
puts " attrs_json: #{m.attrs_json}"
puts " obj_attrs_json: #{m.obj_attrs_json}"
# Try to get combined attrs
begin
h_res = Basic.get_std_method_attrs(m, gene_filtering_step)
combined_attrs = h_res[:h_attrs] || {}
puts " Combined attrs keys: #{combined_attrs.keys.inspect}"
# Check for input requirements
has_requirements = false
combined_attrs.each do |key, val|
if val.is_a?(Hash) && val['source_steps'].present? && val['valid_types'].present?
has_requirements = true
puts " REQUIRED INPUT: #{key}"
puts " source_steps: #{val['source_steps']}"
puts " valid_types: #{val['valid_types']}"
end
end
if !has_requirements
puts " NO INPUT REQUIREMENTS - Should pass: YES"
end
rescue => e
puts " Error getting attrs: #{e.message}"
end
end
end
end
puts "\n\n"
# Check normalization
normalization_step = Step.where(docker_image_id: asap_docker_image.id, name: 'normalization').first
if normalization_step
puts "=== NORMALIZATION STEP (#{normalization_step.id}) ===\n"
std_methods = StdMethod.where(docker_image_id: asap_docker_image.id, step_id: normalization_step.id, obsolete: false).all
puts "StdMethods: #{std_methods.count}\n"
if std_methods.empty?
puts "NO STD_METHODS - Should be unlocked: YES\n\n"
else
std_methods.each do |m|
puts "\nStdMethod #{m.id} (#{m.name}):"
puts " attrs_json: #{m.attrs_json}"
puts " obj_attrs_json: #{m.obj_attrs_json}"
# Try to get combined attrs
begin
h_res = Basic.get_std_method_attrs(m, normalization_step)
combined_attrs = h_res[:h_attrs] || {}
puts " Combined attrs keys: #{combined_attrs.keys.inspect}"
# Check for input requirements
has_requirements = false
combined_attrs.each do |key, val|
if val.is_a?(Hash) && val['source_steps'].present? && val['valid_types'].present?
has_requirements = true
puts " REQUIRED INPUT: #{key}"
puts " source_steps: #{val['source_steps']}"
puts " valid_types: #{val['valid_types']}"
end
end
if !has_requirements
puts " NO INPUT REQUIREMENTS - Should pass: YES"
end
rescue => e
puts " Error getting attrs: #{e.message}"
end
end
end
end