-
Notifications
You must be signed in to change notification settings - Fork 4
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
ASG Suspend #37
Open
dyaxley
wants to merge
155
commits into
master
Choose a base branch
from
asgSuspend
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+14,191
−8,831
Open
ASG Suspend #37
Changes from 35 commits
Commits
Show all changes
155 commits
Select commit
Hold shift + click to select a range
d8a0a5a
first cut
dyaxley 9282775
first cut
dyaxley f61fd37
Test out asg suspend
dyaxley 582baa2
Test out asg suspend
dyaxley 5106c11
rejig functions
dyaxley 871fd8d
update func name
dyaxley cf937b2
dryrun
dyaxley c43fb90
test suspending
dyaxley 37ca8fb
added suspend and resume to iam
dyaxley a4e2625
instances as array
dyaxley c3b1c78
update array
dyaxley 26da142
fix the resume
dyaxley b832da4
resume?
dyaxley d107aaf
log inst
dyaxley 79f8203
fix resume issue in start.js
dyaxley 7145d6d
logg everything
dyaxley d55fa42
update iam to include kms create grant to allow lamda to start encryp…
dyaxley 896dfec
minor update
dyaxley 9ce3044
Update to suspend all processes
dyaxley cf3781d
Added weekend off param
dyaxley 796418d
default to false
dyaxley 4f0e406
default to false
dyaxley 4b15335
hmmm
dyaxley 10e07bd
clean up function
dyaxley 3049a2d
fix cron days
dyaxley 7d93b0c
temp fix
dyaxley 0be98ec
add comment
dyaxley dc3d302
update function
dyaxley 7a7f111
update tests
dyaxley 8bc8690
updates to weekendsOff logic to support timezones & updates to npm pa…
dyaxley 2e8d1b2
fix up linting
dyaxley 34b4848
updates to var name
dyaxley 9c41d18
added some tests for asg suspend
dyaxley 24fdcc6
added tests for asg suspend feature
dyaxley b4069d1
Updates to readme
dyaxley 3fcf6d4
Merge branch 'master' into asgSuspend
petercrotty d6082ec
W2C-453 - move code
petercrotty e3ce7e6
Debug
petercrotty b4440bf
Get cron dates working again
petercrotty 1bac343
Correct days of the week
petercrotty a1e0349
Retry when RequestLimitExceeded
petercrotty 25d975f
Add logging
petercrotty 5463f13
Add more error handling
petercrotty 7de0939
Correct syntax
petercrotty 90f8c7a
Correct syntax
petercrotty 040f4af
Correct syntax
petercrotty eb41079
Correct syntax
petercrotty cd6cc17
Add more error handling
petercrotty 41e6b2f
Add more error handling
petercrotty 4361818
Try different Params for deleteTag
petercrotty 8a55518
add sleep between the stop process
katevucmd 1150561
ahhhhhhhhhhhhhhhhhhhhhhhhhhhh
katevucmd a989ed3
upgrade version
katevucmd 87122fd
add sleep function
katevucmd 3407051
fix import function
katevucmd 9fcdafc
fix import function?
katevucmd ea74f2a
fix import function?
katevucmd 0098e72
add filter for stop function :fingercrossed
katevucmd 4b12a35
comment unused function
katevucmd 5ee2f1c
add filter for stopasg and stop instances
katevucmd 6a06d94
increase timeout
katevucmd 8d82f87
fix filter for tag
katevucmd ebc0463
wrong tag name :(((((
katevucmd 4b2db77
comment filter by operating hour and add more log
katevucmd b0901bf
add more comment
katevucmd a7a9387
test with promise
katevucmd d884c5c
test with promise
katevucmd e92147d
fix?
katevucmd d5ea1b3
fix?
katevucmd b1bb555
promise
katevucmd b00744a
promise
katevucmd f5f00cf
promise
katevucmd fd4814b
promise
katevucmd 494bebf
promise
katevucmd 761e77c
promise
katevucmd f06ae39
promise
katevucmd 75b853b
promise
katevucmd a048535
promise
katevucmd 3351811
promise
katevucmd bf3c489
promise
katevucmd f33b354
promise
katevucmd 2c96db0
promise
katevucmd 35d17c0
promise
katevucmd 566bd9f
passing application into filter function
katevucmd 9e4aa7d
add more comments
katevucmd e13aec8
update start function
katevucmd e7d85f7
add variable for sleepTing
katevucmd d9d54ec
test get list of instances
katevucmd 148bdce
test get list of instances
katevucmd 697a56a
test get list of instance
katevucmd 77839f0
test get list of instance ahhhhhhhhhhhhhhhhhhdyiuuuiuy8787687ylhfudasyf
katevucmd 6818f5a
why it does not pass the varialbe why why why why
katevucmd 59acf0b
fix type of params
katevucmd a31c7aa
limit to specific slice for testing
katevucmd ac1bb4d
limit to specific slice for testing for start
katevucmd 70df84b
fix for list asg for suspend
katevucmd 2f38ac9
fix for list asg for suspend for start
katevucmd 7a607fe
fix import function
katevucmd e26858c
test with option all for asg
katevucmd 1959d9c
test with option all for asg
katevucmd 01d4d3e
now we test the stop for real - limit to specific whics_env
katevucmd 045ce12
set dryrun = false does not work?
katevucmd 9ccb322
using env in lambda for dryrun
katevucmd 126b8fa
console.log dryrRUn env
katevucmd 1e19199
fix passing env
katevucmd 0aca552
fix passing env
katevucmd 62fb462
fix passing env for start
katevucmd fa55f91
trouble shooting start function
katevucmd d041a65
comment some for testing
katevucmd ab22909
another test
katevucmd 1363779
test with filter for openning hours
katevucmd e5a634a
remove mock values for testing
katevucmd de1d5cc
update test
katevucmd 3e01a35
update test
katevucmd c2a6426
promise again
katevucmd df3ac14
test
katevucmd 090cc52
remove test
katevucmd 6f0a974
Merge pull request #68 from nib-health-funds/W2C-636
katevucmd 74881d6
set number of trying for retry function, update factors
katevucmd 4486fb1
update
katevucmd 704f6dc
update
katevucmd 98bf0db
update
katevucmd d367000
try catch
katevucmd 22f7591
try catch
katevucmd 0a2c016
test
katevucmd 58c3d01
test
katevucmd df28c41
promise
katevucmd 801f8cd
promiseeeee
katevucmd 584ee9a
yay it works
katevucmd debee1a
update some comment
katevucmd 93e894c
clean
katevucmd c623ab8
clean
katevucmd 3f1b03a
clean
katevucmd e7d8647
clean
katevucmd 087a709
Merge pull request #69 from nib-health-funds/W2C-546
katevucmd c4e6145
add retry
katevucmd 2a4b2f4
set up for testing
katevucmd d6e1a5d
reduce waiting time
katevucmd 7e6b1f2
import retry
katevucmd 2308ffd
fix path for import
katevucmd 38cfa33
import retry
katevucmd 78c7ea5
test promise again
katevucmd 37ac38b
fix startInstances?
katevucmd 4a65aef
add return
katevucmd 8227939
remove wait
katevucmd 50eb5a7
get list of instances for asg
katevucmd 63855c6
get list of instances for asg
katevucmd fa53102
add some check?
katevucmd b2085da
start everything
katevucmd 7d1525f
mock value for testing
katevucmd 511aec8
remove some tag
katevucmd 1175c8c
remove mock test
katevucmd 570097c
reset waiting 4minutes
katevucmd 1bdeaad
Merge pull request #70 from nib-health-funds/W2C-680
katevucmd 7a33352
Merge branch 'master' into asgSuspend
petercrotty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
const luxon = require('luxon'); | ||
const operatingTimezones = require('./operatingTimezones').timezones(); | ||
const isEnabled = require('./isEnabled').isEnabled; | ||
const turnOffWeekends = require('./turnOffWeekends').turnOffWeekends; | ||
|
||
const START_HOUR = parseInt(process.env.HAMMERTIME_START_HOUR || '6', 10); | ||
const STOP_HOUR = parseInt(process.env.HAMMERTIME_STOP_HOUR || '19', 10); | ||
|
||
function getCronHour(hour, zone) { | ||
return luxon.DateTime.fromObject({ hour, zone }).setZone('UTC').hour; | ||
function getCronDayHour(day = '0', hour, zone) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be great to have test coverage of this one given it's fairly crucial to scheduling. |
||
return { | ||
day: luxon.DateTime.fromObject({ weekday: day, hour, zone }).setZone('UTC').weekdayShort, | ||
hour: luxon.DateTime.fromObject({ weekday: day, hour, zone }).setZone('UTC').hour, | ||
}; | ||
} | ||
|
||
function getCron(hour, timezone) { | ||
const week = { | ||
dayBegin: getCronDayHour('1', hour, timezone).day, | ||
dayEnd: getCronDayHour('5', hour, timezone).day, | ||
}; | ||
const cronHour = getCronDayHour(hour, timezone).hour; | ||
return (turnOffWeekends ? `cron(0 ${cronHour} ? * ${week.dayBegin}-${week.dayEnd} *)` : `cron(0 ${cronHour} * * ? *)`); | ||
} | ||
|
||
function stop() { | ||
const stopCrons = operatingTimezones.map(timezone => ({ | ||
rate: `cron(0 ${getCronHour(STOP_HOUR, timezone)} * * ? *)`, | ||
rate: getCron(STOP_HOUR, timezone), | ||
enabled: isEnabled(), | ||
input: { | ||
currentOperatingTimezone: timezone, | ||
|
@@ -24,7 +37,7 @@ function stop() { | |
|
||
function start() { | ||
const startCrons = operatingTimezones.map(timezone => ({ | ||
rate: `cron(0 ${getCronHour(START_HOUR, timezone)} * * ? *)`, | ||
rate: getCron(START_HOUR, timezone), | ||
enabled: isEnabled(), | ||
input: { | ||
currentOperatingTimezone: timezone, | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably deserves to be in the readme