Skip to content

Commit

Permalink
Fix double negative when computing remaining memory % in terraform de…
Browse files Browse the repository at this point in the history
…ployment (#407)

If TOTAL_AVAIL_MEMORY was 100, then this computed

    $(( 100 - - 10 - 5 ))

Which is actually 105. Now it's

    $(( 100 - 10 - 5 ))

Which is 85, as the comment originally claimed.
  • Loading branch information
cormacrelf committed Nov 19, 2023
1 parent 9e31ca4 commit 9e981a5
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -47,7 +47,7 @@ elif [ "$TYPE" == "cas" ]; then
# 5% goes to the index memory cache.
export NATIVE_LINK_CAS_INDEX_CACHE_LIMIT=$(( $TOTAL_AVAIL_MEMORY / 20 ))
# 85% goes to the content memory cache.
export NATIVE_LINK_CAS_CONTENT_LIMIT=$(( $TOTAL_AVAIL_MEMORY - - $NATIVE_LINK_AC_CONTENT_LIMIT - $NATIVE_LINK_CAS_INDEX_CACHE_LIMIT ))
export NATIVE_LINK_CAS_CONTENT_LIMIT=$(( $TOTAL_AVAIL_MEMORY - $NATIVE_LINK_AC_CONTENT_LIMIT - $NATIVE_LINK_CAS_INDEX_CACHE_LIMIT ))

/usr/local/bin/native-link /root/cas.json
elif [ "$TYPE" == "scheduler" ]; then
Expand All @@ -56,7 +56,7 @@ elif [ "$TYPE" == "scheduler" ]; then
# 5% goes to the index memory cache.
export NATIVE_LINK_CAS_INDEX_CACHE_LIMIT=$(( $TOTAL_AVAIL_MEMORY / 20 ))
# 85% goes to the content memory cache.
export NATIVE_LINK_CAS_CONTENT_LIMIT=$(( $TOTAL_AVAIL_MEMORY - - $NATIVE_LINK_AC_CONTENT_LIMIT - $NATIVE_LINK_CAS_INDEX_CACHE_LIMIT ))
export NATIVE_LINK_CAS_CONTENT_LIMIT=$(( $TOTAL_AVAIL_MEMORY - $NATIVE_LINK_AC_CONTENT_LIMIT - $NATIVE_LINK_CAS_INDEX_CACHE_LIMIT ))

/usr/local/bin/native-link /root/scheduler.json
elif [ "$TYPE" == "worker" ]; then
Expand Down

0 comments on commit 9e981a5

Please sign in to comment.