Skip to content

Commit

Permalink
Merge branch 'dev' into docs/docusaurus
Browse files Browse the repository at this point in the history
  • Loading branch information
danuw committed Feb 13, 2024
2 parents 590f262 + b45c456 commit 20d120b
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 10 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="header" align="center">
<img style=”margin: 0px” src=hack-banner.png alt=”banner” height=”500" />
<img style=”margin: 0px” src=./images/hack-banner.png alt=”banner” height=”500" />
</div>

----------------------------
Expand All @@ -26,8 +26,7 @@ The Carbon Aware SDK is a toolset to help you measure the carbon emissions of yo
![Carbon Aware Software](./images/carbon-aware-software.png)


By knowing the carbon emissions of the energy that powers your applications,
you and your organisation can leverage greener energy sources to reduce your CO2 emissions by:
By knowing the carbon emissions of the energy that powers your applications, you and your organisation can leverage greener energy sources to reduce your CO2 emissions by:

* Building AI models when carbon emissions are lower
* Deploying software into the cloud in locations that have greener energy sources
Expand Down Expand Up @@ -100,9 +99,7 @@ deployment in the greenest location.

The Carbon Aware SDK is being used by large and small companies around the
world. Some of the world’s biggest enterprises and software companies, through
to start-ups. Both UBS and Vestas have used the SDK, with further details over on the [adopters overview](./docs/adopters.md).

Both UBS and Vestas have used the SDK, with further details over on the [adopters page](./docs/adopters.md).
to start-ups. Both UBS and Vestas have used the SDK, with further details over on the [adopters overview](./casdk-docs/docs/overview/adopters.md).

Machine Learning (ML) workloads are a great example of long running compute
intensive workloads, that often are also not time critical. By moving these workloads to a different time, the carbon emissions from the ML training can be reduced by up to 15%, and by moving the location of the training this can be
Expand Down
7 changes: 7 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Security Policy

## Reporting a Vulnerability

To report a security issue, please email [email protected] with a description of the issue, steps required to reproduce the issue, affected versions and, if known, mitigations for the issue.

Our contributors are comprised of volunteers so we cannot guarantee a specific response time, but someone from our team will reply and address the issue as soon as possible.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion casdk-docs/blog/2021-08-26-welcome/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Carbon aware software does more when it can leverage greener energy sources, and

The Carbon Aware SDK is a toolset to help you measure the carbon emissions of your software, in turn helping you **measure and reduce your software's carbon emissions**, and choose when and where you run your software to make it greener.

![Carbon Aware Software](../../docs/images/carbon-aware-software.png)
![Carbon Aware Software](./carbon-aware-software.png)


By knowing the carbon emissions of the energy that powers your applications, you and your organisation can leverage greener energy sources to reduce your CO2 emissions by:
Expand Down
37 changes: 36 additions & 1 deletion casdk-docs/docs/overview/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ Make sure you have installed the following pre-requisites to setup your local
environment:

- dotnet core SDK
[https://dotnet.microsoft.com/en-us/download](https://dotnet.microsoft.com/en-us/download)
[https://dotnet.microsoft.com/en-us/download/dotnet/6.0](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)

- Access to one (or all) of the supported external data APIs
- WattTime account - See
[instruction on WattTime](https://docs.watttime.org/#tag/Authentication/operation/post_username_register_post)
Expand Down Expand Up @@ -359,6 +360,40 @@ appsettings: |-
}
}
}

# Location source
# Location data will be deployed into /app/location-sources/json .
locationSources:
enabled: false
# files:
# - fileName: custom-locations-1.json
# locations: |-
# {
# "east": {
# "Latitude": "35.68",
# "Longitude": "139.77",
# "Name": "eastdc"
# },
# "west": {
# "Latitude": "34.6939",
# "Longitude": "135.5022",
# "Name": "westdc"
# }
# }
# - fileName: custom-locations-2.json
# locations: |-
# {
# "north": {
# "Latitude": "35.68",
# "Longitude": "139.77",
# "Name": "northdc"
# },
# "south": {
# "Latitude": "34.6939",
# "Longitude": "135.5022",
# "Name": "southdc"
# }
# }
```
The video in below is demonstration to install Carbon Aware SDK via Helm. Note that installing the SDK from local directory ( ~/github-forked/carbon-aware-sdk/helm-chart ), not an OCI container.
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0
version: 1.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
13 changes: 13 additions & 0 deletions helm-chart/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.locationSources.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: location-sources
namespace: {{ $.Release.Namespace }}
labels:
{{- include "carbon-aware-sdk.labels" . | nindent 4 }}
data:
{{- range .Values.locationSources.files }}
{{ .fileName }}: {{- toYaml .locations | nindent 4 }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions helm-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ spec:
mountPath: /app/appsettings.json
subPath: appsettings.json
readOnly: true
{{- if .Values.locationSources.enabled }}
- name: location-sources
mountPath: /app/location-sources/json
readOnly: true
{{- end }}
livenessProbe:
httpGet:
path: /health
Expand All @@ -60,6 +65,16 @@ spec:
- name: appsettings
secret:
secretName: appsettings
{{- if .Values.locationSources.enabled }}
- name: location-sources
configMap:
name: location-sources
items:
{{- range .Values.locationSources.files }}
- key: {{ .fileName }}
path: {{ .fileName }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
34 changes: 34 additions & 0 deletions helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,37 @@ appsettings: |-
}
}
}
# Location source
# Location data will be deployed into /app/location-sources/json .
locationSources:
enabled: false
# files:
# - fileName: custom-locations-1.json
# locations: |-
# {
# "east": {
# "Latitude": "35.68",
# "Longitude": "139.77",
# "Name": "eastdc"
# },
# "west": {
# "Latitude": "34.6939",
# "Longitude": "135.5022",
# "Name": "westdc"
# }
# }
# - fileName: custom-locations-2.json
# locations: |-
# {
# "north": {
# "Latitude": "35.68",
# "Longitude": "139.77",
# "Name": "northdc"
# },
# "south": {
# "Latitude": "34.6939",
# "Longitude": "135.5022",
# "Name": "southdc"
# }
# }
Binary file added images/hack-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/CarbonAware.LocationSources/src/LocationSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private IEnumerable<LocationSourceFile> DiscoverFiles()
return Array.Empty<LocationSourceFile>();
}
_logger.LogInformation($"{files.Count()} files discovered");
return files.Select(x => x.Substring(pathCombined.Length + 1)).Select(n => new LocationSourceFile { DataFileLocation = n });
return files.Select(x => x.Substring(pathCombined.Length + 1)).Where(n => !n.StartsWith("..")).Select(n => new LocationSourceFile { DataFileLocation = n });
}

private void AddToLocationMap(string key, NamedGeoposition data, string sourceFile, Dictionary<string, int> keyCounter)
Expand Down

0 comments on commit 20d120b

Please sign in to comment.