Giter Club home page Giter Club logo

Comments (3)

arieleeuw avatar arieleeuw commented on September 14, 2024

Hi,

yes, you need two periods in the schedule to do this type of scheduling

First create a period that is active from midnight until 1am

$ scheduler-cli create-period --stack InstanceScheduler --name period-midnight-1am --begintime 00:00 --endtime 01:00
{
"Period": {
"Endtime": "01:00",
"Type": "period",
"Name": "period-midnight-1am",
"Begintime": "00:00"
}
}

Then a second one that is active from 6am until midnight (note we use 23:59 as begin must be < than end). The scheduler (make sure you have the latest version installed) will detect that the two periods are adjacent and will not stop the instance at 23:59 as there is the next period that starts one minute later at 00:00)

$ scheduler-cli create-period --stack InstanceScheduler --name period-6am-midnight --begintime 06:00 --endtime 23:59
{
"Period": {
"Endtime": "23:59",
"Type": "period",
"Name": "period-6am-midnight",
"Begintime": "06:00"
}
}

Now create the schedule that contains there periods and also specifies the timezone

$scheduler-cli create-schedule --stack InstanceScheduler --name schedule-stop-between-1am-6am --periods period-midnight-1am,period-6am-midnight --timezone Europe/London

{
"Schedule": {
"RetainRunning": false,
"Enforced": false,
"Name": "schedule-stop-between-1am-6am",
"StopNewInstances": true,
"Periods": [
"period-6am-midnight",
"period-midnight-1am"
],
"Timezone": "Europe/London",
"Type": "schedule"
}
}

Now tag (Using the tag-name "Schedule" assuming you used the default name") the Instance with the name of the schedule "schedule-stop-between-1am-6am"

A great way to check if the schedule is scheduling as you expect is to use the following command that shows which periods are active in a specific date range (default if you don't specify a start/end date is today). As you see the scheduler logic detects the adjacent periods in the schedule.

$ scheduler-cli describe-schedule-usage --stack InstanceScheduler --name schedule-stop-between-1am-6am
{
"Usage": {
"2018-08-17": {
"BillingHours": 19,
"RunningPeriods": {
"Period-6am-midnight": {
"Begin": "08/17/18 06:00:00",
"End": "08/18/18 00:00:00",
"BillingHours": 18,
"BillingSeconds": 64800
},
"Period-midnight-1am": {
"Begin": "08/17/18 00:00:00",
"End": "08/17/18 01:00:00",
"BillingHours": 1,
"BillingSeconds": 3600
}
},
"BillingSeconds": 68400
}
},
"Schedule": "schedule-stop-between-1am-6am"
}

Hope this answers your question
Arie

from instance-scheduler-on-aws.

krishnaCNagalla avatar krishnaCNagalla commented on September 14, 2024

Hi arieleeuw,

Thank you so much for your response and I apologize for the late response. I some how was able to figure out the same solution base on your other answers in this space and didn't get a chance to get back here to thank you.

This solution worked for me perfectly. Thank you so much again for you time and response.

from instance-scheduler-on-aws.

shsenior avatar shsenior commented on September 14, 2024

Closing due to time elapsed since last correspondence. Please re-open this if you are still having an issue.

from instance-scheduler-on-aws.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.