Skip to content
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

Update scripts to enable rest function call only for node #5 and #6 #676

Conversation

ehgmsdk20
Copy link
Member

@ehgmsdk20 ehgmsdk20 commented Nov 9, 2021

Changes:

  • updated scripts for function call server node

Related issues:

@@ -225,10 +225,10 @@ printf "\n\n##########################\n# Starting parent node 4 #\n############
gcloud compute ssh $NODE_4_TARGET_ADDR --command "$START_NODE_COMMAND_BASE 0 4 $ACCOUNT_INJECTION_OPTION" --project $PROJECT_ID --zone $NODE_4_ZONE
inject_account "4"
printf "\n\n##########################\n# Starting parent node 5 #\n##########################\n\n"
gcloud compute ssh $NODE_5_TARGET_ADDR --command "$START_NODE_COMMAND_BASE 0 5 $ACCOUNT_INJECTION_OPTION" --project $PROJECT_ID --zone $NODE_5_ZONE
gcloud compute ssh $NODE_5_TARGET_ADDR --command "$START_NODE_COMMAND_BASE 0 5 $ACCOUNT_INJECTION_OPTION --restfunc" --project $PROJECT_ID --zone $NODE_5_ZONE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about ---rest-func like --keep-code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks good! i edited. PTAL

@@ -178,6 +178,9 @@ function deploy_node() {
# 2. Start node
printf "\n\n[[[[ Starting node $node_index ]]]]\n\n"
START_CMD="gcloud compute ssh $node_target_addr --command '. start_node_incremental_gcp.sh $SEASON 0 $node_index $SYNC_MODE $ACCOUNT_INJECTION_OPTION' --project $PROJECT_ID --zone $node_zone"
if [[ $node_index -gt 4 ]]; then
START_CMD="gcloud compute ssh $node_target_addr --command '. start_node_incremental_gcp.sh $SEASON 0 $node_index $SYNC_MODE $ACCOUNT_INJECTION_OPTION --restfunc' --project $PROJECT_ID --zone $node_zone"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what bout using a variable e.g. REST_FUNC_OPTION?

if [[ $node_index -gt 4 ]]; then
        REST_FUNC_OPTION="--rest-func"
else
        REST_FUNC_OPTION=""
fi
START_CMD="gcloud compute ssh $node_target_addr --command '. start_node_incremental_gcp.sh $SEASON 0 $node_index $SYNC_MODE $ACCOUNT_INJECTION_OPTION $REST_FUNC_OPTION --project $PROJECT_ID --zone $node_zone"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks more readable! thanks

parse_options "$5"
fi
fi
ENABLE_REST_FUNCTION_CALL="false"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about using a variable e.g. REST_FUNC_OPTION (see KEEP_CODE_OPTION)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I edited it, but I don't know if I understood your intention clearly.

if [[ "$#" -lt 4 ]] || [[ "$#" -gt 5 ]]; then
printf "Usage: bash start_node_incremental_gcp.sh [dev|staging|spring|summer] <Shard Index> <Node Index> [fast|full] [--keystore|--mnemonic]\n"
if [[ "$#" -lt 4 ]] || [[ "$#" -gt 6 ]]; then
printf "Usage: bash start_node_incremental_gcp.sh [dev|staging|spring|summer] <Shard Index> <Node Index> [fast|full] [--keystore|--mnemonic] [--restfunc]\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto (--rest-func)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

function parse_options() {
local option="$1"
if [[ "$option" = '--restfunc' ]]; then
ENABLE_REST_FUNCTION_CALL="true"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! PTAL

@platfowner
Copy link
Member

platfowner commented Nov 9, 2021

Could you update the PR title with a more relevant one?

@ehgmsdk20 ehgmsdk20 changed the title Update scripts Update scripts to enable rest function call only for node #5 and #6 Nov 9, 2021
inject_account "6"
NUM_NODES=7
index=0
while [ $index -lt $NUM_NODES ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice refactoring, thanks!

ACCOUNT_INJECTION_OPTION=""
REST_FUNC_OPTION=""

if [[ "$#" -gt 4 ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: what about using the while loop used in in start_node_genesis_gcp.sh?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I edited, thanks!

Copy link
Member

@platfowner platfowner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some minor comments.
Thanks for the nice implementation!

@ehgmsdk20 ehgmsdk20 merged commit b916c34 into develop Nov 10, 2021
@platfowner platfowner deleted the feature/ehgmsdk20/update-deploy-script-for-function-call-server branch July 14, 2023 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants