-
Notifications
You must be signed in to change notification settings - Fork 230
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
#234 use master/worker terminology #268
#234 use master/worker terminology #268
Conversation
xdist/dsession.py
Outdated
@@ -46,7 +46,7 @@ def __init__(self, config): | |||
self._failed_collection_errors = {} | |||
self._active_nodes = set() | |||
self._failed_nodes_count = 0 | |||
self._max_slave_restart = self.config.getoption('max_slave_restart') | |||
self._max_slave_restart = self.config.getoption('max_worker_restart') |
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.
It would be better if the code was also changed to use worker rather than slave. Does this code also support the old command line option to stop everything breaking during transition?
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.
No, I just renamed to new method. Do you need support old value? I'll add support
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'm not in charge here, but I think it would be best if a deprecation notice is used for the old command so that it is still supported for a couple of releases before being dropped.
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.
It would be better if the code was also changed to use worker rather than slave
I didn't change another code bacause it must be changed in pytest repo else. Do you think I need rename all code?
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 meant, can we stop using "slave" in the xdist code everywhere, and not just in the messages seen by users? Using worker externally and slave internally seems like a weird inconsistency when the aim is to remove slave nomenclature everywhere. I wasn't saying anything about other pytest repos.
PS Thanks for tackling this. I really do appreciate this getting done since I haven't had a chance to have a go myself.
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.
Ok, I'll remove all "slave" from code, but there is one file which uses in pytest. So, I need to create commit in pytest repo else
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.
@feuillemorte you mean the slaveinput
attribute of the config
object? I think for that case we can have both names, slaveinput
and workerinput
which point to the same dictionary so we can keep backward compatibility.
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.
@nicoddemus ok, thank you!
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.
Thanks a ton @feuillemorte for tackling this, we really appreciate it.
Please see my comments. 😁
xdist/plugin.py
Outdated
@@ -26,8 +26,8 @@ def pytest_addoption(parser): | |||
help="shortcut for '--dist=load --tx=NUM*popen', " | |||
"you can use 'auto' here for auto detection CPUs number on " | |||
"host system") | |||
group.addoption('--max-slave-restart', action="store", default=None, | |||
help="maximum number of slaves that can be restarted " | |||
group.addoption('--max-worker-restart', action="store", default=None, |
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.
IIRC you can pass multiple values here to support aliases:
group.addoption('--max-worker-restart', '--max-slave-restart', action="store", ...
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 want to add dest value like:
group.addoption('--max-worker-restart', '--max-slave-restart', action="store", default=None, dest="maxworkerrestart", help="maximum number of workers that can be restarted " "when crashed (set to zero to disable this feature)\n" "'--max-slave-restart' option is deprecated and will be removed in next versions")
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 good, perhaps just changing "in next versions" to "in a future release". 👍
xdist/dsession.py
Outdated
@@ -46,7 +46,7 @@ def __init__(self, config): | |||
self._failed_collection_errors = {} | |||
self._active_nodes = set() | |||
self._failed_nodes_count = 0 | |||
self._max_slave_restart = self.config.getoption('max_slave_restart') | |||
self._max_slave_restart = self.config.getoption('max_worker_restart') |
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.
@feuillemorte you mean the slaveinput
attribute of the config
object? I think for that case we can have both names, slaveinput
and workerinput
which point to the same dictionary so we can keep backward compatibility.
…te/pytest-xdist into 234-master-worker-terminology
Please, test locally. Tests ran successfuly, but.. :) |
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.
Thanks @feuillemorte for the follow up! 😁
Please take a look at my comments when you have the time.
testing/test_remote.py
Outdated
@@ -26,7 +26,7 @@ def __str__(self): | |||
return "<EventCall %s(**%s)>" % (self.name, self.kwargs) | |||
|
|||
|
|||
class SlaveSetup: | |||
class workerSetup: |
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.
WorkerSetup
testing/test_remote.py
Outdated
class TestSlaveInteractor: | ||
def test_basic_collect_and_runtests(self, slave): | ||
slave.testdir.makepyfile(""" | ||
class TestworkerInteractor: |
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.
TestWorkerInteractor
xdist/looponfail.py
Outdated
|
||
|
||
class SlaveFailSession: | ||
class workerFailSession: |
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.
WorkerFailSession
xdist/remote.py
Outdated
@@ -14,11 +14,11 @@ | |||
import pytest | |||
|
|||
|
|||
class SlaveInteractor: | |||
class workerInteractor: |
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.
WorkerInteractor
xdist/workermanage.py
Outdated
@@ -201,19 +201,19 @@ def make_reltoroot(roots, args): | |||
return result | |||
|
|||
|
|||
class SlaveController(object): | |||
class workerController(object): |
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.
WorkerController
ENDMARK = -1 | ||
|
||
def __init__(self, nodemanager, gateway, config, putevent): | ||
self.nodemanager = nodemanager | ||
self.putevent = putevent | ||
self.gateway = gateway | ||
self.config = config | ||
self.slaveinput = {'slaveid': gateway.id, | ||
'slavecount': len(nodemanager.specs)} | ||
self.workerinput = {'workerid': gateway.id, |
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.
Please add an alias here for backward compatibility:
# deprecated name, backward compatibility only
self.slaveinput = workerinput
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
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.
this dict also need the old names (slaveid
and slavecount
)
and we likely need to keep those for around 5 years at least
i propose adding as is and later on following up with a dict subclass that gives deprecation warnings in a few years
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.
Ah good catch, I missed those. 👍
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.
config.slaveoutput = {} | ||
interactor = SlaveInteractor(config, channel) | ||
config.workerinput = workerinput | ||
config.workeroutput = {} |
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.
Please add aliases here for backward compatibility:
# deprecated name, backward compatibility only
config.slaveinput = config.workerinput
config.slaveoutput = config.workeroutput
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
how to use linter? :) |
|
Thanks @feuillemorte for the quick update! LGTM so far, let's wait for @RonnyPfannschmidt's review. |
@timj please, approve too |
Added an explicit test for backward compatibility of the old |
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 believe we covered all that needs covering now
so this is good to go, thanks 👍
i do have a lingering fear that a minor detail is missing, but thise should be sortable very easily
@feuillemorte great work, thanks again 👍 |
Do we really need to also rename the |
Lines 29 to 30 in 63b329c
|
Use master/worker terminologi in arguments