mirror of https://github.com/nucypher/nucypher.git
Split up singles from couples, so many Ursulas!
parent
273ad23bf8
commit
5be6363d8c
|
@ -29,25 +29,34 @@ from twisted.internet import reactor
|
|||
from twisted.logger import globalLogPublisher
|
||||
|
||||
from nucypher.utilities.logging import SimpleObserver
|
||||
from nucypher.utilities.sandbox.constants import MOCK_URSULA_STARTING_PORT, select_test_port
|
||||
|
||||
|
||||
def spin_up_federated_ursulas(quantity: int = 2):
|
||||
FLEET_POPULATION = 2
|
||||
|
||||
|
||||
def spin_up_federated_ursulas(quantity: int = FLEET_POPULATION):
|
||||
|
||||
# Logger
|
||||
globalLogPublisher.addObserver(SimpleObserver())
|
||||
|
||||
starting_port = select_test_port()
|
||||
# Ports
|
||||
starting_port = 11501
|
||||
ports = map(str, range(starting_port, starting_port + quantity))
|
||||
ursulas, ursula_processes = set(), list()
|
||||
|
||||
ursula_processes = list()
|
||||
for index, port in enumerate(ports):
|
||||
|
||||
executable = 'nucypher'
|
||||
args = ['nucypher', 'ursula', 'run',
|
||||
'--federated-only', '--rest-port', port,
|
||||
'--dev', '--debug']
|
||||
teacher_uri = '127.0.0.1:{}'.format(int(port) - 1)
|
||||
|
||||
if index != 0: # Skip first iteration
|
||||
args.extend(['--teacher-uri', 'https://127.0.0.1:{}'.format(int(port)-1)])
|
||||
args = ['nucypher',
|
||||
'ursula', 'run',
|
||||
'--rest-port', port,
|
||||
'--teacher-uri', teacher_uri,
|
||||
'--federated-only',
|
||||
'--dev',
|
||||
'--debug',
|
||||
'--config-root', 'demo-ursula-{}'.format(port)
|
||||
]
|
||||
|
||||
env = {'PATH': os.environ['PATH'],
|
||||
'NUCYPHER_SENTRY_LOGS': '0',
|
||||
|
@ -55,7 +64,9 @@ def spin_up_federated_ursulas(quantity: int = 2):
|
|||
'LC_ALL': 'C.UTF-8',
|
||||
'LANG': 'C.UTF-8'}
|
||||
|
||||
childFDs = {0: 0, 1: 1, 2: 2}
|
||||
childFDs = {0: 0,
|
||||
1: 1,
|
||||
2: 2}
|
||||
|
||||
class UrsulaProcessProtocol(protocol.Protocol):
|
||||
|
||||
|
@ -63,10 +74,10 @@ def spin_up_federated_ursulas(quantity: int = 2):
|
|||
self.command = command
|
||||
|
||||
processProtocol = UrsulaProcessProtocol(command=args)
|
||||
p = reactor.spawnProcess(processProtocol, executable, args, env=env, childFDs=childFDs)
|
||||
p = reactor.spawnProcess(processProtocol, 'nucypher', args, env=env, childFDs=childFDs)
|
||||
ursula_processes.append(p)
|
||||
|
||||
reactor.run()
|
||||
reactor.run() # GO!
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
|
@ -0,0 +1,38 @@
|
|||
"""
|
||||
This file is part of nucypher.
|
||||
|
||||
nucypher is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
nucypher is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
|
||||
# WARNING This is not a mining script!
|
||||
# you will not perform any re-encryptions, and you will not get paid.
|
||||
# It might be (but might not be) useful for determining whether you have
|
||||
# the proper dependencies and configuration to run an actual mining node.
|
||||
|
||||
|
||||
from click.testing import CliRunner
|
||||
from nucypher.cli.main import nucypher_cli
|
||||
|
||||
|
||||
click_runner = CliRunner()
|
||||
|
||||
args = ['ursula', 'run',
|
||||
'--rest-port', 11500, # REST Server
|
||||
'--federated-only', # Operating Mode
|
||||
'--dev', # In-Memory
|
||||
'--debug', # Non-Interactive + Verbose
|
||||
'--lonely'] # Disable Seednode Learning
|
||||
|
||||
nucypher_cli.main(args=args, prog_name="nucypher-cli")
|
|
@ -1,23 +1,43 @@
|
|||
from click.testing import CliRunner
|
||||
from nucypher.cli.main import nucypher_cli
|
||||
import sys
|
||||
"""
|
||||
This file is part of nucypher.
|
||||
|
||||
nucypher is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
nucypher is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
|
||||
# WARNING This is not a mining script!
|
||||
# you will not perform any re-encryptions, and you will not get paid.
|
||||
# It might be (but might not be) useful for determining whether you have
|
||||
# the proper dependencies and configuration to run an actual mining node.
|
||||
|
||||
|
||||
from click.testing import CliRunner
|
||||
|
||||
from nucypher.cli.main import nucypher_cli
|
||||
from nucypher.utilities.sandbox.constants import select_test_port
|
||||
|
||||
click_runner = CliRunner()
|
||||
|
||||
port = select_test_port()
|
||||
|
||||
try:
|
||||
learner_port = sys.argv[1]
|
||||
except IndexError:
|
||||
learner_port = None
|
||||
DEMO_NODE_PORT = select_test_port()
|
||||
DEMO_FLEET_STARTING_PORT = 11501
|
||||
|
||||
args = ['ursula', 'run',
|
||||
'--federated-only', '--rest-port', port,
|
||||
'--dev', '--debug']
|
||||
'--federated-only',
|
||||
'--teacher-uri', f'https://127.0.0.1:{DEMO_FLEET_STARTING_PORT}',
|
||||
'--rest-port', DEMO_NODE_PORT,
|
||||
'--dev',
|
||||
'--debug',
|
||||
]
|
||||
|
||||
if learner_port:
|
||||
args.extend(['--teacher-uri', 'https://127.0.0.1:{}'.format(int(learner_port))])
|
||||
|
||||
nucypher_cli.main(args=args or (), prog_name="nucypher-cli")
|
||||
nucypher_cli.main(args=args, prog_name="nucypher-cli")
|
||||
|
|
Loading…
Reference in New Issue