Commit edecd728 authored by Guillaume Bouvignies's avatar Guillaume Bouvignies Committed by GitHub

refactor: Update `add_service` to use `ServiceConfig` for its `config` arg (#67)

parent 8e5d1855
...@@ -45,7 +45,7 @@ def launch_forkmon( ...@@ -45,7 +45,7 @@ def launch_forkmon(
def get_config(config_files_artifact_uuid): def get_config(config_files_artifact_uuid):
config_file_path = shared_utils.path_join(FORKMON_CONFIG_MOUNT_DIRPATH_ON_SERVICE, FORKMON_CONFIG_FILENAME) config_file_path = shared_utils.path_join(FORKMON_CONFIG_MOUNT_DIRPATH_ON_SERVICE, FORKMON_CONFIG_FILENAME)
return struct( return ServiceConfig(
image = IMAGE_NAME, image = IMAGE_NAME,
ports = USED_PORTS, ports = USED_PORTS,
files = { files = {
......
...@@ -52,7 +52,7 @@ def get_grafana_config_dir_artifact_uuid(plan, datasource_config_template, dashb ...@@ -52,7 +52,7 @@ def get_grafana_config_dir_artifact_uuid(plan, datasource_config_template, dashb
def get_config(grafana_config_artifacts_uuid, grafana_dashboards_artifacts_uuid): def get_config(grafana_config_artifacts_uuid, grafana_dashboards_artifacts_uuid):
return struct( return ServiceConfig(
image = IMAGE_NAME, image = IMAGE_NAME,
ports = USED_PORTS, ports = USED_PORTS,
env_vars = {CONFIG_DIRPATH_ENV_VAR: GRAFANA_CONFIG_DIRPATH_ON_SERVICE}, env_vars = {CONFIG_DIRPATH_ENV_VAR: GRAFANA_CONFIG_DIRPATH_ON_SERVICE},
......
...@@ -223,7 +223,7 @@ def get_beacon_config( ...@@ -223,7 +223,7 @@ def get_beacon_config(
cmd.extend([param for param in extra_params]) cmd.extend([param for param in extra_params])
return struct( return ServiceConfig(
image = image, image = image,
ports = BEACON_USED_PORTS, ports = BEACON_USED_PORTS,
cmd = cmd, cmd = cmd,
...@@ -284,7 +284,7 @@ def get_validator_config( ...@@ -284,7 +284,7 @@ def get_validator_config(
cmd.extend([param for param in extra_params]) cmd.extend([param for param in extra_params])
return struct( return ServiceConfig(
image = image, image = image,
ports = VALIDATOR_USED_PORTS, ports = VALIDATOR_USED_PORTS,
cmd = cmd, cmd = cmd,
......
...@@ -198,7 +198,7 @@ def get_beacon_config( ...@@ -198,7 +198,7 @@ def get_beacon_config(
# this is a repeated<proto type>, we convert it into Starlark # this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params]) cmd.extend([param for param in extra_params])
return struct( return ServiceConfig(
image = image, image = image,
ports = USED_PORTS, ports = USED_PORTS,
cmd = cmd, cmd = cmd,
...@@ -250,7 +250,7 @@ def get_validator_config( ...@@ -250,7 +250,7 @@ def get_validator_config(
cmd.extend([param for param in extra_params]) cmd.extend([param for param in extra_params])
return struct( return ServiceConfig(
image = image, image = image,
ports = USED_PORTS, ports = USED_PORTS,
cmd = cmd, cmd = cmd,
......
...@@ -206,7 +206,7 @@ def get_config( ...@@ -206,7 +206,7 @@ def get_config(
cmd_str = " ".join(cmd) cmd_str = " ".join(cmd)
return struct( return ServiceConfig(
image = image, image = image,
ports = USED_PORTS, ports = USED_PORTS,
cmd = [cmd_str], cmd = [cmd_str],
......
...@@ -216,7 +216,7 @@ def get_beacon_config( ...@@ -216,7 +216,7 @@ def get_beacon_config(
# we do the for loop as otherwise its a proto repeated array # we do the for loop as otherwise its a proto repeated array
cmd.extend([param for param in extra_params]) cmd.extend([param for param in extra_params])
return struct( return ServiceConfig(
image = beacon_image, image = beacon_image,
ports = BEACON_NODE_USED_PORTS, ports = BEACON_NODE_USED_PORTS,
cmd = cmd, cmd = cmd,
...@@ -274,7 +274,7 @@ def get_validator_config( ...@@ -274,7 +274,7 @@ def get_validator_config(
cmd.extend([param for param in extra_params]) cmd.extend([param for param in extra_params])
return struct( return ServiceConfig(
image = validator_image, image = validator_image,
ports = VALIDATOR_NODE_USED_PORTS, ports = VALIDATOR_NODE_USED_PORTS,
cmd = cmd, cmd = cmd,
......
...@@ -208,7 +208,7 @@ def get_config( ...@@ -208,7 +208,7 @@ def get_config(
cmd_str = " ".join(cmd) cmd_str = " ".join(cmd)
return struct( return ServiceConfig(
image = image, image = image,
ports = USED_PORTS, ports = USED_PORTS,
cmd = [cmd_str], cmd = [cmd_str],
......
...@@ -118,7 +118,7 @@ def get_config(network_id, genesis_data, image, existing_el_clients, log_level, ...@@ -118,7 +118,7 @@ def get_config(network_id, genesis_data, image, existing_el_clients, log_level,
launch_node_command_str = " ".join(launch_node_command) launch_node_command_str = " ".join(launch_node_command)
return struct( return ServiceConfig(
image = image, image = image,
ports = USED_PORTS, ports = USED_PORTS,
cmd = [launch_node_command_str], cmd = [launch_node_command_str],
......
...@@ -119,7 +119,7 @@ def get_config(network_id, genesis_data, image, existing_el_clients, verbosity_l ...@@ -119,7 +119,7 @@ def get_config(network_id, genesis_data, image, existing_el_clients, verbosity_l
command_arg_str = " && ".join(command_arg) command_arg_str = " && ".join(command_arg)
return struct( return ServiceConfig(
image = image, image = image,
ports = USED_PORTS, ports = USED_PORTS,
cmd = [command_arg_str], cmd = [command_arg_str],
......
...@@ -167,7 +167,7 @@ def get_config(network_id, genesis_data, prefunded_geth_keys_artifact_uuid, pref ...@@ -167,7 +167,7 @@ def get_config(network_id, genesis_data, prefunded_geth_keys_artifact_uuid, pref
] ]
command_str = " && ".join(subcommand_strs) command_str = " && ".join(subcommand_strs)
return struct( return ServiceConfig(
image = image, image = image,
ports = USED_PORTS, ports = USED_PORTS,
cmd = [command_str], cmd = [command_str],
......
...@@ -114,7 +114,7 @@ def get_config(genesis_data, image, existing_el_clients, log_level, extra_params ...@@ -114,7 +114,7 @@ def get_config(genesis_data, image, existing_el_clients, log_level, extra_params
# we do this as extra_params is a repeated proto aray # we do this as extra_params is a repeated proto aray
command_args.extend([param for param in extra_params]) command_args.extend([param for param in extra_params])
return struct( return ServiceConfig(
image = image, image = image,
ports = USED_PORTS, ports = USED_PORTS,
cmd = command_args, cmd = command_args,
......
...@@ -36,7 +36,7 @@ def get_config(mev_boost_launcher, network_id): ...@@ -36,7 +36,7 @@ def get_config(mev_boost_launcher, network_id):
command.append("-relays") command.append("-relays")
command.append(",".join(mev_boost_launcher.relay_end_points)) command.append(",".join(mev_boost_launcher.relay_end_points))
return struct( return ServiceConfig(
image = FLASHBOTS_MEV_BOOST_IMAGE, image = FLASHBOTS_MEV_BOOST_IMAGE,
ports = USED_PORTS, ports = USED_PORTS,
cmd = command cmd = command
......
...@@ -25,7 +25,7 @@ def launch_prelaunch_data_generator(plan, files_artifact_mountpoints): ...@@ -25,7 +25,7 @@ def launch_prelaunch_data_generator(plan, files_artifact_mountpoints):
def get_config( def get_config(
files_artifact_mountpoints, files_artifact_mountpoints,
): ):
return struct( return ServiceConfig(
image = IMAGE, image = IMAGE,
entrypoint = ENTRYPOINT_ARGS, entrypoint = ENTRYPOINT_ARGS,
files = files_artifact_mountpoints, files = files_artifact_mountpoints,
......
...@@ -38,7 +38,7 @@ def launch_prometheus(plan, config_template, cl_client_contexts): ...@@ -38,7 +38,7 @@ def launch_prometheus(plan, config_template, cl_client_contexts):
def get_config(config_files_artifact_uuid): def get_config(config_files_artifact_uuid):
config_file_path = shared_utils.path_join(CONFIG_DIR_MOUNTPOINT_ON_PROMETHEUS, shared_utils.path_base(CONFIG_FILENAME)) config_file_path = shared_utils.path_join(CONFIG_DIR_MOUNTPOINT_ON_PROMETHEUS, shared_utils.path_base(CONFIG_FILENAME))
return struct( return ServiceConfig(
image = IMAGE_NAME, image = IMAGE_NAME,
ports = USED_PORTS, ports = USED_PORTS,
files = { files = {
......
...@@ -52,14 +52,14 @@ def get_cmd(params, el_client_contexts, cl_client_contexts, add_binary_name): ...@@ -52,14 +52,14 @@ def get_cmd(params, el_client_contexts, cl_client_contexts, add_binary_name):
def get_asynchronous_verification_config(params, el_client_contexts, cl_client_contexts): def get_asynchronous_verification_config(params, el_client_contexts, cl_client_contexts):
commands = get_cmd(params, el_client_contexts, cl_client_contexts, False) commands = get_cmd(params, el_client_contexts, cl_client_contexts, False)
return struct( return ServiceConfig(
image = IMAGE_NAME, image = IMAGE_NAME,
cmd = commands, cmd = commands,
) )
def get_synchronous_verification_config(): def get_synchronous_verification_config():
return struct( return ServiceConfig(
image = IMAGE_NAME, image = IMAGE_NAME,
entrypoint = SYNCHRONOUS_ENTRYPOINT_ARGS, entrypoint = SYNCHRONOUS_ENTRYPOINT_ARGS,
) )
...@@ -16,7 +16,7 @@ def get_config(prefunded_addresses, el_client_context): ...@@ -16,7 +16,7 @@ def get_config(prefunded_addresses, el_client_context):
comma_separated_private_keys = ",".join(private_keys_strs) comma_separated_private_keys = ",".join(private_keys_strs)
comma_separated_addresses = ",".join(address_strs) comma_separated_addresses = ",".join(address_strs)
return struct( return ServiceConfig(
image = IMAGE_NAME, image = IMAGE_NAME,
cmd = [ cmd = [
"http://{0}:{1}".format(el_client_context.ip_addr, el_client_context.rpc_port_num), "http://{0}:{1}".format(el_client_context.ip_addr, el_client_context.rpc_port_num),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment