Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### ✨ New features and improvements
- Added a confirm dialog to the Upload Scans form that appears when no template divisions are assigned to the selected exam template (#7993)
- Forward the test batch id to the autotester so AI grading telemetry can attribute mass-grading runs (#7991)
- Migrated `MarkingSchemesTable` component to React Table V8 (#7985)
- Removed Graders Subcomponent and added a Graders column in the Assignment Grades tab (#7967)
- Added GET and PATCH /overall_comment API routes (#7963)
Expand Down
12 changes: 8 additions & 4 deletions app/helpers/automated_tests_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ def test_data(test_run_ids)
end

def get_markus_address(host_with_port)
base = ENV.fetch('MARKUS_URL', host_with_port)
if Rails.application.config.relative_url_root.nil?
host_with_port
base
else
host_with_port + Rails.application.config.relative_url_root
base + Rails.application.config.relative_url_root
end
end

Expand Down Expand Up @@ -209,6 +210,8 @@ def run_tests(assignment, host_with_port, group_ids, role, collected: true, batc
req.body = {
test_data: test_data,
categories: role.student? ? ['student'] : ['instructor'],
# Maps to TestBatch.id for telemetry attribution; null for solo runs.
batch_id: batch&.id,
request_high_priority: batch.nil? && role.student?
}.to_json
res = send_request!(req, uri)
Expand Down Expand Up @@ -307,10 +310,11 @@ def set_headers(req, api_key)

# Get the current URL for this MarkUs instance (adds the relative url root to +host_with_port+) if it exists.
def get_markus_address(host_with_port)
base = ENV.fetch('MARKUS_URL', host_with_port)
if Rails.application.config.relative_url_root.nil?
host_with_port
base
else
host_with_port + Rails.application.config.relative_url_root
base + Rails.application.config.relative_url_root
end
end

Expand Down
22 changes: 22 additions & 0 deletions spec/jobs/autotest_run_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,28 @@
end
end
end

context 'batch_id attribution' do
it 'forwards the batch id for a multi-group run' do
expect_any_instance_of(AutotestRunJob).to receive(:send_request!) do |_j, net_obj|
expect(JSON.parse(net_obj.body)['batch_id']).to eq TestBatch.first.id
dummy_return
end
subject
end

context 'when there is a single group' do
let(:n_groups) { 1 }

it 'forwards a null batch id for a solo run' do
expect_any_instance_of(AutotestRunJob).to receive(:send_request!) do |_j, net_obj|
expect(JSON.parse(net_obj.body)).to include('batch_id' => nil)
dummy_return
end
subject
end
end
end
end

context 'tests are not set up' do
Expand Down
Loading