-
Notifications
You must be signed in to change notification settings - Fork 19
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
Rudimentary q table #42
Conversation
d74284c
to
1b6f50d
Compare
self.providers_offers = data['providers_offers'] | ||
self.self_state = data['self_state'] | ||
|
||
def choose_best_option(self, providers): |
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.
Seems very "hard coded"
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.
I moved values to the single constant to have less "hard coded code"
@Jaapp- I think smth failed here with Jenkins(or integration to git), because I think all the tests pass now and so it looks on the Jenkins. |
plebnet/agent/core.py
Outdated
@@ -34,21 +35,28 @@ def setup(args): | |||
agent. All necessary configuration files are created and IRC communication is started. | |||
:param args: If running in Testnet mode. | |||
""" | |||
global dna, config | |||
global dna, qtable, config |
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.
remove dna
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.
done
plebnet/agent/core.py
Outdated
@@ -13,6 +13,8 @@ | |||
import subprocess | |||
import shutil | |||
|
|||
from plebnet.agent.qtable import QTable | |||
|
|||
from plebnet.agent.dna import DNA |
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.
remove unused imports
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.
done
plebnet/agent/core.py
Outdated
@@ -218,6 +221,8 @@ def attempt_purchase(): | |||
""" | |||
Check if enough money to buy a server, and if so, do so, | |||
""" | |||
config = PlebNetConfig() | |||
qtable = QTable() |
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.
check if it is crucial
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.
removed
plebnet/agent/qtable.py
Outdated
""" | ||
Creates the QTable configuration for the child agent. This is done by copying the own QTable configuration and including the new host provider, the parent name and the transaction hash. | ||
:param provider: the name the child tree name. | ||
:param tree: tree of inheritance |
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.
remove line above
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.
done
plebnet/clone/create-child.sh
Outdated
@@ -29,7 +29,9 @@ export DEBIAN_FRONTEND=noninteractive | |||
cd | |||
|
|||
CHILD_DNA_FILE=~/.config/Child_DNA.json | |||
#CHILD_QTABLE_FILE= |
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.
@HusainKapadia why is this commented?
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.
fixed properly
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.
Because when I wrote this the QTable.json had not been created. I'll add the correct paths if you haven't done so yet
tests/agent/test_core.py
Outdated
@@ -228,65 +227,65 @@ def test_update_offer(self): | |||
cloudomate_controller.update_offer = self.uo | |||
PlebNetConfig.save = self.save | |||
|
|||
def test_attempt_purchase(self): | |||
def test_attempt_purchase(self): |
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.
@HusainKapadia I think it is better not to comment code but to remove it.
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.
fixed
6b7b74b
to
645418d
Compare
It seems that the Plebnet job on Jenkins is filling up slots on our machines (because it is stuck): https://jenkins-ci.tribler.org. Please have a look at this 👍 |
|
@devos50 @Jaapp- It looks like https://jenkins-ci.tribler.org/job/GH_Plebnet_PR_Tests/job/GH_PlebNet_coverage_check/17/console is stuck and all subsequent coverage check jobs are waiting for it to finish. Is it possible to kill the build now and set a timeout so it does not happen in future? |
@MattSkala yes. @Jaapp- has login credentials for Jenkins so he can kill these jobs. In the job settings, you can specify either a fixed timeout or a dynamic timeout (that is based on the duration of previous runs). |
@MattSkala I will try to do the 1-4 of your remarks now as I agree with them. Ad 5 I am not sure it is not better to do as seperate PR in the next sprint :)
|
@rpytel1 would you like to split the work? We can discuss about it tomorrow after or before the meeting. |
@HusainKapadia no, I prefer to do it alone and finish it today. |
I created a separate issue for the VPN selection: #49 Also, please rebase to the current develop and try to investigate why tests are failing on the CI: https://jenkins-ci.tribler.org/job/GH_Plebnet_PR_Tests/job/GH_PlebNet_tests/21/console |
adfbb8c
to
c45870d
Compare
I think I did changes matching the remarks of @MattSkala. I did also rebase and resolved conflicts with develop. I don't know why two tests are crashing on Jenkins :( |
Tests are failing because you are replacing |
a1de0b2
to
c45870d
Compare
c0b9f4d
to
fb89e76
Compare
PR is working with test fixed still in 2018 :D |
|
1d24162
to
b550420
Compare
I think it all works but would appreciate if someone (@MattSkala) would check it ( |
857bbde
to
234b7a6
Compare
@@ -318,19 +320,17 @@ def select_provider(): | |||
""" | |||
if not config.get('chosen_provider'): | |||
logger.log("No provider chosen yet", log_name) | |||
all_providers = dna.vps | |||
all_providers = cloudomate_controller.get_vps_providers().keys() | |||
excluded_providers = config.get('excluded_providers') | |||
available_providers = list(set(all_providers.keys()) - set(excluded_providers)) | |||
providers = {k: all_providers[k] for k in all_providers if k in available_providers} | |||
|
|||
if providers >= 1 and sum(providers.values()) > 0: |
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.
I think the condition should be len(providers) >= 1
Some notes after a discussion and deeper inspection of the code:
|
Ad 1: |
Ad 5: Is it really Pull Request related? |
2-4 fixed and tested. I will wait until we decide what to do with 1 and 5 :) |
Ad 1:
Ok, I think I understand the original motivation now. It probably makes sense for positive updates (we were able to buy the current option, install PlebNet on it, and earn enough BTC). The negatives update is more complicated though. There are 2 types of failures:
Currently if we fail to purchase a chosen offer, we penalize even the current state for that, which I think is probably not right. Ad 5: Not really, we can also create a separate issue for that, but I think it's just a two-line change. |
Also, I had a look at the tests and I think the asserted conditions could be somewhat stronger. Especially in |
Is 2) really fixed? I can't find any related changes in the last commit. Maybe you forgot to push it. Ad 4) I think the bandwidth is in TB, so the constant value should be 10 instead of 10000. |
595 additional lines, becoming impressive! Code coverage tracking would be great at some point. |
2258964
to
d716896
Compare
AD1: In my opinion it makes sense what you wrote, so I fixed it accordingly. Let me know when PR is ready to be merged so I will make everything in one commit with meaningful code message |
d8356fa
to
f3f04d3
Compare
@rpytel1 Looks good, I think it is ready to merge. We can do any further changes (simulated annealing) as a separate PR. Can you please squash the commits into one? |
f3f04d3
to
7615d8b
Compare
No description provided.