-
Notifications
You must be signed in to change notification settings - Fork 786
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
BB: Refactor agent communication check #2388
Conversation
Codecov ReportBase: 61.25% // Head: 61.24% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #2388 +/- ##
===========================================
- Coverage 61.25% 61.24% -0.01%
===========================================
Files 552 552
Lines 14429 14431 +2
===========================================
Hits 8838 8838
- Misses 5591 5593 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
.vscode/settings.json
Outdated
{ | ||
"python.linting.mypyEnabled": true, | ||
"python.linting.enabled": true, | ||
"python.testing.cwd": "./monkey", | ||
"python.testing.pytestArgs": [], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added by mistake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep... not sure how that got added :-)
if not self._did_agent_communicate_back(machine_ip, agent_ips): | ||
self.log.add_entry("Agent from {} didn't communicate back".format(machine_ip)) | ||
all_monkeys_communicated = False | ||
else: | ||
self.log.add_entry("Monkey from {} communicated back".format(machine_ip)) | ||
self.log.add_entry("Agent from {} communicated back".format(machine_ip)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can rename and invert the logic to make it slightly more readable:
if self._agent_communicated_back():
self.log.add_entry("Agent communicated back")
return True
self.log.add_entry("Agent didn't communicate back")
return False
There are a bunch of variations on that, but the important thing I'm trying to get across is you can rename _did_agent_communicate_back()
and invert the logic. If you do, your logic is almost an English sentence, "if agent communicated back, then...", as opposed to "If not did agent communicate back then"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not I would mind making that change 😉
Updated CommunicationAnalyzer to use the /api/agents and /api/machines endpoints to determine whether or not an agent communicated back to the island.
e67dbc3
to
0ca23cb
Compare
Updated CommunicationAnalyzer to use the /api/agents and /api/machines endpoints to determine whether or not an agent communicated back to the island. Resolves PR #2388
Resolved by 57b4ec4 |
What does this PR do?
Fixes part of #2269.
Updated CommunicationAnalyzer to use the
/api/agents
and/api/machines
endpoints to determine whether or not an agent communicated back to the island.PR Checklist
Was the CHANGELOG.md updated to reflect the changes?Was the documentation framework updated to reflect the changes?Testing Checklist
Added relevant unit tests?