#234 use master/worker terminology#268
#234 use master/worker terminology#268nicoddemus merged 8 commits intopytest-dev:masterfrom feuillemorte:234-master-worker-terminology
Conversation
xdist/dsession.py
Outdated
| 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.
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.
No, I just renamed to new method. Do you need support old value? I'll add support
There was a problem hiding this comment.
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.
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.
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.
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.
@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.
nicoddemus
left a comment
There was a problem hiding this comment.
Thanks a ton @feuillemorte for tackling this, we really appreciate it.
Please see my comments. 😁
xdist/plugin.py
Outdated
| "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.
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.
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.
Seems good, perhaps just changing "in next versions" to "in a future release". 👍
xdist/dsession.py
Outdated
| 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.
@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.. :) |
nicoddemus
left a comment
There was a problem hiding this comment.
Thanks @feuillemorte for the follow up! 😁
Please take a look at my comments when you have the time.
testing/test_remote.py
Outdated
|
|
||
|
|
||
| class SlaveSetup: | ||
| class workerSetup: |
testing/test_remote.py
Outdated
| class TestSlaveInteractor: | ||
| def test_basic_collect_and_runtests(self, slave): | ||
| slave.testdir.makepyfile(""" | ||
| class TestworkerInteractor: |
xdist/looponfail.py
Outdated
|
|
||
|
|
||
| class SlaveFailSession: | ||
| class workerFailSession: |
xdist/remote.py
Outdated
|
|
||
|
|
||
| class SlaveInteractor: | ||
| class workerInteractor: |
xdist/workermanage.py
Outdated
|
|
||
|
|
||
| class SlaveController(object): | ||
| class workerController(object): |
| self.config = config | ||
| self.slaveinput = {'slaveid': gateway.id, | ||
| 'slavecount': len(nodemanager.specs)} | ||
| self.workerinput = {'workerid': gateway.id, |
There was a problem hiding this comment.
Please add an alias here for backward compatibility:
# deprecated name, backward compatibility only
self.slaveinput = workerinput There was a problem hiding this comment.
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.
Ah good catch, I missed those. 👍
There was a problem hiding this comment.
| config.slaveoutput = {} | ||
| interactor = SlaveInteractor(config, channel) | ||
| config.workerinput = workerinput | ||
| config.workeroutput = {} |
There was a problem hiding this comment.
Please add aliases here for backward compatibility:
# deprecated name, backward compatibility only
config.slaveinput = config.workerinput
config.slaveoutput = config.workeroutput|
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 |
RonnyPfannschmidt
left a comment
There was a problem hiding this comment.
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