Git Product home page Git Product logo

camunda-carbon-reductor's Introduction

🌱Camunda Carbon Reductor

The Camunda Carbon Reductor allows you to time shift your processes' carbon emissions when energy is clean while still fulfilling the requested SLAs.

Technically, it's implemented as a Camunda Connector for Camunda Platform 8 and as an External Task Worker for Camunda Platform 7.


You want to contribute 🌱? Please read the Contribution Guidelines.

Table of Contents

✨Features

The Carbon Reductor Connector consists of an element-template that can be used in the process model that connects to the connector function.

Time Shifting Mode ⏭️

Using the time shifting mode (default) the Carbon Reductor Connector allows you to optimize for lower carbon emissions by moving your process execution into a timeframe with the least amount of carbon possible while still fulfilling SLAs.

The Carbon Reductor Connector defines the following inputs:

  • the location where the worker are running (e.g. Germany, UK, France, USA, etc.)
  • a milestone (a timestamp used to calculate the duration the process instance has been running)
  • a duration for the remainder of the process (the duration the remainder needs at most)
  • the maximum duration a process instance can take
  • optionally, set a threshold for the minimum amount of grams of CO2 per kilowatt-hour that should be saved

Measuring Mode 📏

Note: This mode only works with the Carbon Aware SDK API at the moment.

Using the measuring mode the Carbon Reductor Connector allows you to measure the emissions in gCO2e/KWh at execution time and reports as well the emissions at the optimal time while still fulfilling your SLAs.

The same input as in the Time Shifting Mode ⏭️ is required.

🚀Getting Started

We provide the Carbon Reductor for Camunda Platform 7 and 8:

Camunda 8

To start the Camunda 8 Connector have a look at the specific README.

Camunda 7

To start the Camunda 7 External Task Worker have a look at the specific README.

📈Reporting Carbon Reduction via Camunda Optimize

Since Camunda Carbon Reductor stores the carbon savings as process variables, we have the ability to visualize our successes in Camunda Optimize.

For the CarbonHack22 we visualized the results for out example process and it looks like the following:

CarbonHack22 Dashboard

The exported Dashboard Definition could be found here.

🏗Building Blocks

Building Block View Level 0 Camunda Carbon Reductor

Element Description
Carbon Reductor Core Core module which calculates the possible time shifting based on data it fetches from the external systems.
Carbon Aware API Custom Client to connect to the Carbon Aware SDK.
Carbon Aware Computing API Custom Client to connect to the Carbon Aware Computing API.
Camunda Carbon Reductor C8 Camunda 8 Job Worker.
Camunda Carbon Reductor C7 Camunda 7 External Task Worker.

📚Releases

The list of releases contains a detailed changelog.

We use Semantic Versioning.

The following compatibility matrix shows the officially supported Camunda versions for each release. Other combinations might also work but have not been tested.

Release Camunda Platform 8 Camunda Platform 7
2.1.1 8.4.0 7.20.0
2.1.2 8.5.0 7.21.0
2.1.3 8.5.0 7.21.0
Click to see older releases
Release Camunda Platform 8 Camunda Platform 7
1.0.0 8.1.0 7.18.0
1.1.0 8.2.0 7.19.0
2.0.0 8.2.3 7.19.0
2.0.1 8.2.3 7.19.0
2.0.2 8.2.3 7.19.0
2.0.3 8.3.0 7.19.0
2.1.0 8.3.0 7.20.0
2.1.1 8.4.0 7.20.0
2.1.2 8.5.0 7.21.0
2.1.3 8.5.0 7.21.0

Download of Releases:

📆Publications

If you are interested in our work and want to get to know more, feel free to reach out to us.

📨Contact

If you have any questions or ideas feel free to start a discussion or contact us via mail.

This open source project is being developed by envite consulting GmbH.

envite consulting GmbH envite consulting GmbH

camunda-carbon-reductor's People

Contributors

actions-user avatar hehnle avatar henningkrause95 avatar lwluc avatar maxbehr801 avatar tobiasschaefer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

thandayuthapani

camunda-carbon-reductor's Issues

[FEATURE] Improved Variable and Class naming

Is your feature request related to a problem? Please describe.
The variables and domain class names could be improved to be easier to catch.

Describe the solution you'd like
Improved variable and class names, mainly in the core-module.

Additional context
none

[FEATURE] implement minimum threshold for execution delay

Is your feature request related to a problem? Please describe.
Delaying the process may only be wanted if a specific threshold of CO2e reduction is possible.

Describe the solution you'd like

  • Allow setting a minimal amount of g/CO2 per kWh which should be saved at least
  • Think about a retry logic

Additional context
none

[FEATURE] Incident Handling

Is your feature request related to a problem? Please describe.
Incident are not handled equally in C7 and C8: In C7 exceptions are catched in C8 not.

Describe the solution you'd like

  • unify incident handling for C7 / C8
  • potentially add input whether Carbon Reductor errors should be returned to the process

Additional context
none

[BUG] Build and Publish Docker Multi-Arch

Describe the bug

ERROR: Multiple platforms feature is currently not supported for docker driver. Please switch to a different driver (eg. "docker buildx create --use")

See: https://github.com/envite-consulting/camunda-carbon-reductor/actions/runs/5690641292/job/15424376716

Expected behavior
Build and publish für multiple architectures.

Environment (please complete the following information):

  • GitHub Actions only

Additional context
Possible opportunities would:

Fix Problem with ResponseHeader from Carbon-Aware-SDK

java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "de.envite.greenbpm.api.carbonawaresdk.ApiException.getResponseHeaders()" is null
at de.envite.greenbpm.api.carbonawaresdk.ApiException.getMessage(ApiException.java:164)
at ch.qos.logback.classic.spi.ThrowableProxy.(ThrowableProxy.java:78)
at ch.qos.logback.classic.spi.ThrowableProxy.(ThrowableProxy.java:62)
at ch.qos.logback.classic.spi.LoggingEvent.(LoggingEvent.java:119)
a...

[FEATURE] Measurement Mode

Is your feature request related to a problem? Please describe.
To measure the possible impact without the shifting intervention, we add a mode to collect data only.

Describe the solution you'd like
The measurement mode should not time shift the process, it should just collect the data. Using the data, you can analyze the impact time shifting has on your business process.

Additional context
Measuring the impact first offers a better basis for argumentation.

de.envite.greenbpm.api.carbonawaresdk.ApiException: Message: Forbidden

Hello friends of Camunda and the planet, I hope this message finds you well!

I follow these documents step by step:
camunda-carbon-reductor-c8
AND
api-carbon-aware

I was able to create the user on watttime.org and generate the token through login.

I made the changes indicated in docker-compose as follows:
docker-compose.yaml

I uploaded docker with docker-compose up and tested:
http://localhost:8090/emissions/forecasts/current?location=westus
It's working correctly.

However, the connector is giving an incident:
Expected to throw an error event with the code 'carbon-reductor-error' with message 'Could not query API to get infos about future emissions', but it was not caught. No error events are available in the scope.

In the camunda-8-carbon-reductor-connector docker console:

2023-10-14 10:29:11 2023-10-14 13:29:11.223 ERROR 1 --- [pool-1-thread-1] d.e.g.c.c.a.w.CarbonAwareSdkClient : Error when calling the API for the optimalForecastUntil
2023-10-14 10:29:11
2023-10-14 10:29:11 de.envite.greenbpm.api.carbonawaresdk.ApiException: Message: Forbidden
2023-10-14 10:29:11 HTTP response code: 403
2023-10-14 10:29:11 HTTP response body: {"title":"WattTimeClientHttpException","status":403,"detail":"Error requesting forecast?ba=UK","traceId":"00- 304b5b25e57e4c7b918e9dba41e166c2-f751c3da54859e37-01","errors":{}}
2023-10-14 10:29:11 HTTP response headers: {content-type=[application/problem+json; charset=utf-8], date=[Sat, 14 Oct 2023 13:29:10 GMT], server=[Kestrel], transfer-encoding=[chunked]}
2023-10-14 10:29:11 at de.envite.greenbpm.api.carbonawaresdk.ApiClient.handleResponse(ApiClient.java:1115) ~[api-carbon-aware-2.0.2.jar!/:2.0.2 ]
2023-10-14 10:29:11 at de.envite.greenbpm.api.carbonawaresdk.ApiClient.execute(ApiClient.java:1028) ~[api-carbon-aware-2.0.2.jar!/:2.0.2 ]
2023-10-14 10:29:11 at de.envite.greenbpm.api.carbonawaresdk.api.CarbonAwareApi.getCurrentForecastDataWithHttpInfo(CarbonAwareApi.java:790) ~[api-carbon-aware-2.0.2.jar!/:2.0 .two]
2023-10-14 10:29:11 at de.envite.greenbpm.carbonreductor.core.adapter.watttime.CarbonAwareSdkClient.getOptimalForecastUntil(CarbonAwareSdkClient.java:37) ~[carbon-reductor-core-2.0.2.jar!/ :2.0.2]
2023-10-14 10:29:11 at de.envite.greenbpm.carbonreductor.core.adapter.watttime.CarbonAwareSdkClient.getEmissionTimeframe(CarbonAwareSdkClient.java:28) ~[carbon-reductor-core-2.0.2.jar!/ :2.0.2]
2023-10-14 10:29:11 at de.envite.greenbpm.carbonreductor.core.domain.service.DelayCalculatorService.calculateDelay(DelayCalculatorService.java:39) ~[carbon-reductor-core-2.0.2.jar!/ :2.0.2]
2023-10-14 10:29:11 at de.envite.greenbpm.carbonreductorconnector.adapter.in.zeebe.CarbonReductorWorker.execute(CarbonReductorWorker.java:45) ~[classes!/:2.0.2]
2023-10-14 10:29:11 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
2023-10-14 10:29:11 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
2023-10-14 10:29:11 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
2023-10-14 10:29:11 at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
2023-10-14 10:29:11 at io.camunda.zeebe.spring.client.bean.MethodInfo.invoke(MethodInfo.java:51) ~[spring-client-zeebe-8.2.3.jar!/:8.2 .3]
2023-10-14 10:29:11 at io.camunda.zeebe.spring.client.jobhandling.JobHandlerInvokingSpringBeans.handle(JobHandlerInvokingSpringBeans.java:52) ~[spring-client-zeebe-8.2.3.jar!/:8.2 .3]
2023-10-14 10:29:11 at io.camunda.zeebe.client.impl.worker.JobRunnableFactory.executeJob(JobRunnableFactory.java:44) ~[zeebe-client-java-8.2.3.jar!/:8.2 .3]
2023-10-14 10:29:11 at io.camunda.zeebe.client.impl.worker.JobRunnableFactory.lambda$create$0(JobRunnableFactory.java:39) ~[zeebe-client-java-8.2.3.jar! /:8.2.3]
2023-10-14 10:29:11 at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
2023-10-14 10:29:11 at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
2023-10-14 10:29:11 at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
2023-10-14 10:29:11 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
2023-10-14 10:29:11 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
2023-10-14 10:29:11 at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]

I'd like to know what's wrong.

[FEATURE] Camunda Platform 7.20 Update

Is your feature request related to a problem? Please describe.
Camunda Platform 7.20 is released with compatibility to Spring Boot 3.1 (see).

Describe the solution you'd like

  • Camunda Platform Update to 7.20
    • Camunda test dependencies should be updated as well
  • Spring Boot Update to 3.1

Additional context

[FEATURE] GraalVM

Is your feature request related to a problem? Please describe.
To reduce the resource usage of the worker we should ahead-of-time compile our applications with GraalVM.

Describe the solution you'd like
We're compiling the worker to a native image using GraalVM (Docker multi-stage build maybe).
Also have a look at building a custom JDK distribution (jlink) for smaller target images.

Goal is to optimize resource usage and reduce startup time as well as memory consumption.

Additional context
By switching to GraalVM we can consider using Micronaut as framework.

[BUG] Connection issues: Client not settable

Describe the bug
Due to the fact, that the camunda.client.mode is not settable as environment variable some connection scenarios are not possible (like SaaS e.g.).

Expected behavior

Setting the camunda.client.mode=saas to establish a connection.

Environment (please complete the following information):

  • Camunda 8
  • Reductor 2.1.1

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.