Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Add auto-distributor logging #14897

Closed
wants to merge 5 commits into from

Conversation

yoomlam
Copy link
Contributor

@yoomlam yoomlam commented Aug 5, 2020

Resolves #14629

Description

Please explain the changes you made here.

Acceptance Criteria

  • Code compiles correctly

Testing Plan

  1. Go to ...

Code Documentation Updates

  • Add or update code comments at the top of the class, module, and/or component.

@va-bot
Copy link
Collaborator

va-bot commented Aug 5, 2020

1 Warning
⚠️ PR is classed as Work in Progress

Generated by 🚫 Danger

@codeclimate
Copy link

codeclimate bot commented Aug 5, 2020

Code Climate has analyzed commit e5d5df6 and detected 6 issues on this pull request.

Here's the issue category breakdown:

Category Count
Style 5
Bug Risk 1

View more on Code Climate.

@@ -250,7 +250,7 @@
it "describes what changes will be made and makes them" do
automatic_org_message = "Reassigning #{task_count} tasks with ids #{ids_output} to " \
"#{team_member_count} members of the parent tasks' organization"
expect(Rails.logger).to receive(:info).with(automatic_org_message)
# TO FIX: expect(Rails.logger).to receive(:info).with(automatic_org_message)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hschallhorn Is there a better way to test these?
If we end up adding logging to the distributors, the new logging causes these expect statements to fail since the new logging will occur first.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will adding an expect(Rails.logger).to receive(:info).with(round_robin_logging) before this line work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, but I don't want to pollute this test with out-of-scope code.
We won't need to do logging since I identified the problem.

&.tasks
&.open
&.find_by(assigned_to: assignee_pool)
&.assigned_to

@state[:appeal_id] = options[:appeal]&.id
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lomky Here's how I'm doing the logging. I populate @state with bits of state (similar to how Raven/Sentry does it I think).

Comment on lines +83 to +85
elements = [:class, :invoker, :appeal_id, :task_class, :task_id, :latest_task_id, :last_assignee_id, :next_index,
:existing_assignee, :assignee_pool]
log_string = "RRDTracking;" + elements.map { |key| "#{key}: #{@state[key]}" }.join("; ")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lomky Then I log the state here. We should also probably clear the state after logging, but Colocated org creates a new Distributor with each next_assignee call, so it probably doesn't matter.

@yoomlam
Copy link
Contributor Author

yoomlam commented Aug 7, 2020

No need to collect info; problem was identified: #14629 (comment)

@yoomlam yoomlam closed this Aug 7, 2020
@yoomlam yoomlam reopened this Aug 7, 2020
@yoomlam yoomlam closed this Aug 7, 2020
@@ -19,7 +19,7 @@

before do
total_distribution_count.times do
create(:task, assigned_to: colocated_task_distributor.next_assignee)
create(:ama_colocated_task)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a ColocatedTask enables task.create_and_auto_assign_child_task to be called.

@yoomlam yoomlam deleted the yoom/14629_auto_distributor_logging branch February 9, 2021 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Identify problem with or collect information on RoundRobin Automatic Task Assignments
4 participants