Skip to main content

Scheduler shifts given scripts to time when most renwables available

Project description

renops-scheduler

renops-scheduler is a Python package that allows you to schedule and execute scripts at the time the most renewable energy is available.

This reduces the carbon footprint and stabilises the grid of our operations. In cases where the electricity price is variable, the scheduler also reduces utility costs. While its main focus are energy-intensive processing tasks such as big data analytics or AI model training, it may be used to shift any energy-intensive load such as HVAC.

Requirements

Before you begin, ensure you have met the following requirements:

  • Python: Version 3.8 or higher.

To check your Python version, run:

$ python3 --version

Installation

To install renops-scheduler, run the following command:

$ pip install renops-scheduler --index-url https://tango:Nxi3tSRWNzxFpyAxdATv@gitlab.xlab.si/api/v4/projects/2476/packages/pypi/simple

NOTE: Command includes deploy token valid until 31.12.2024. Send a request to obtain a new deploy token, if accessing this after the given date.

Usage

Once you have installed renops-scheduler, you can use it to schedule and execute Python scripts in command line interface (CLI).

To use the program, follow these steps:

  1. Open a terminal or command prompt.

  2. Create a new file named test.py containing:

    $ echo 'print("hello world!")' > test.py
    
  3. Export RENOPSAPI_KEY env:

    $ export RENOPSAPI_KEY="TANGO_DEMO_KEY" 
    

    NOTE: This is demo key with limited number of request. Contanct us to obtain personal access token.

  4. Run the following command to execute the script with a deadline of 24 hours:

    $ renops-scheduler test.py -la -r 6 -d 24 -v
    

    This will execute the test.py in an optimal window within the given deadline.

    • -la sets automatic location detection (uses machines public IP!),
    • -r 6 sets runtime (estimated by user),
    • -d 24 sets the deadline to 24 hours.
  5. Scheduler can also find interval with minimal energy price:

    $ renops-scheduler test.py -la -r 6 -d 24 -v --optimise-price
    

    This is achieved by adding --optimise-price flag.

  6. Running scheduler without automatic location detection:

    $ renops-scheduler test.py -l "Berlin,Germany" -r 6 -d 24 -v
    

    In cases where a user does not want to expose its IP, due to privacy concerns, we can manually specify a rough location in a text description.

Import Example

from renops.scheduler import Scheduler

# Define a function with an argument that scheduler will execute
def test_run(a, text: str):
    print("Hello World!")
    print("Passed keyword argument:", text)
    print("Passed argument:", a)

# Intialise the scheduler
s = Scheduler(runtime=1,
              deadline=1,
              location="Kranj",
              verbose=True,
              optimise_price=True,
              action=test_run,
              argument=([42]),
              kwargs={"text": "Scheduler Test!"})

# Run the scheduler
s.run()

Arguments

The program accepts several command-line arguments to customize the execution. Here's an overview of the available options:

usage: renops-scheduler [-h] -l LOCATION [-r RUNTIME] [-d DEADLINE] [-v VERBOSE] script_path

positional arguments:
  script_path           Path to the script to be executed.

options:
  -h, --help            show this help message and exit
  -l LOCATION, --location LOCATION
                        Location can be specified in two ways:
                        
                        1. Pass a specific location as a string, e.g., "Berlin, Germany".
                        
                        2. Use automatic location detection based on IP address.
                         By using this tag, you agree that your IP can be used to detect your location.
                        You can use any of the following values for this purpose:
                           -l a (-la)
                           -l auto
                           -l automatic
  -r RUNTIME, --runtime RUNTIME
                        Runtime in hours. (User estimated) - Deafult is 3 hours
  -d DEADLINE, --deadline DEADLINE
                        Deadline in hours, by when should script finish running - Default is 120 hours
  -op, --optimise-price
                        Optimise for energy price.
  -v, --verbose         Verbose mode.

Privacy

The script does not pose security or privacy concerns, as it runs locally. The communication between our forecasting API is encrypted and includes an approximate location of the requested forecast. Automatic localization through IP is mandatory and must be manually set.

Notes

  • renops-scheduler is currently in beta version and may contain bugs or limitations.
  • Send possible suggestions, bugs and improvements to jakob.jenko@xlab.si

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

renops_scheduler-0.3.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

renops_scheduler-0.3.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file renops_scheduler-0.3.1.tar.gz.

File metadata

  • Download URL: renops_scheduler-0.3.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for renops_scheduler-0.3.1.tar.gz
Algorithm Hash digest
SHA256 d560c851fcf9590c58ad08d84d34a70592b2bc872ba45997dd612bc73f1d8a1f
MD5 27e287ae910e49100c9dae85cf4d95ae
BLAKE2b-256 b478b735111e4294d91d7eda87385d2149df81c089a42150a2684d5d32c7c0d1

See more details on using hashes here.

File details

Details for the file renops_scheduler-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for renops_scheduler-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60546d58d8d6bbc9822dabc61a06ab77479cc88711b6ffb6bed1d452f3b99401
MD5 ad47d93c4a1bf47a441e8f5b75793351
BLAKE2b-256 5588ee1551f4629c32d88b1fbc6a9998ac15e169d64322c0bb4acf866b97f2cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page