Skip to content

Customizing memory and cpu specifications for VMs - #33

Open
Layth17 wants to merge 2 commits into
wustl-oncology:mainfrom
Layth17:custom-mem-cpu
Open

Layth17 wants to merge 2 commits into
wustl-oncology:mainfrom
Layth17:custom-mem-cpu

Conversation

@Layth17

@Layth17 Layth17 commented Mar 7, 2023

Copy link
Copy Markdown
Member
  • Order matters!
    bash start.sh $GCS_INSTANCE_NAME --server-account $GCS_SERVICE_ACCOUNT --project $GCS_PROJECT --custom-cpu 10 --custom-memory 64G --boot-disk-size=200GB is ok .... but bash start.sh $GCS_INSTANCE_NAME --server-account $GCS_SERVICE_ACCOUNT --project $GCS_PROJECT --boot-disk-size=200GB --custom-cpu 10 --custom-memory 64G is not

because boot-disk-size is a param taken in through the @ and at that point MEM and CPU weren't specified so MACHINE_TYPE was added by default to the list of params.

In other words, set the flags that start.sh ask for first then add flags accepted by GCP afterwards.

I do not think this is new/unique to this case. This is probably just a new finding for me.

@Layth17

Layth17 commented Mar 7, 2023

Copy link
Copy Markdown
Member Author

rework* of parameters

@Layth17 Layth17 linked an issue Mar 7, 2023 that may be closed by this pull request
@Layth17

Layth17 commented Mar 27, 2023

Copy link
Copy Markdown
Member Author

if MACHINE_TYPE is not specified by user then it is defaulted to e2-standard-2

if either MEM or CPU are empty, then --machine-type=$MACHINE_TYPE is added to the list of params.

@Layth17
Layth17 marked this pull request as ready for review March 27, 2023 23:39
@Layth17
Layth17 requested a review from tmooney March 27, 2023 23:39

@tmooney tmooney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Generally makes sense to me!

Comment thread manual-workflows/start.sh Outdated
;;
--custom-memory*)
if [ ! "$2" ]; then
die 'ERROR: "--custome-memory" requires an argument'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
die 'ERROR: "--custome-memory" requires an argument'
die 'ERROR: "--custom-memory" requires an argument'

Comment thread manual-workflows/start.sh Outdated
# optionally add either machine type when neither --custom-memory
# nor --custom-cpu are specified
if [ -z "$MEM" ] || [ -z "$CPU" ]; then
echo "$MEM BLAAAAH $CPU"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like set -x for debugging shell scripts! (echo works too 🙂--just a reminder to remove this line before we merge it in.)

Comment thread manual-workflows/start.sh Outdated
)

# optionally add either machine type when neither --custom-memory
# nor --custom-cpu are specified

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To be nitpicky about this comment: we're adding machine type when either --custom-memory or --custom cpu are not specified as well as when neither are specified. (You might say it "add machine type unless --custom-memory and --custom-cpu are specified".)

I could see having it throw an error if only one of the two is specified though.

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.

Customizing VM's CPU/RAM instead of setting --machine-type

2 participants