Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7bae6ee

Browse files
committed
Update the help and readme with details of the SDK.
1 parent b3cfda9 commit 7bae6ee

File tree

3 files changed

+65
-4
lines changed

3 files changed

+65
-4
lines changed

README.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ Circa is a project for [Carbon Hack 22](https://taikai.network/en/gsf/hackathons
4949
<dt><b>-d</b> &lt;duration&gt;</dt>
5050
<dd>estimated window of runtime of command/task in minutes</dd>
5151
<dt><b>-u</b> &lt;api url&gt;</dt>
52-
<dd>url prefix of Carbon Aware API server to consult</dd>
52+
<dd>
53+
url prefix of Carbon Aware API server to consult OR<br>
54+
full path to Carbon Aware CLI executable
55+
</dd>
5356
</dl>
5457

5558
### Configuration
@@ -173,8 +176,60 @@ make
173176
### Building on Ubuntu
174177

175178
```
176-
sudo apt-get install -y build-essential libjansson-dev libcurl4-openssl-dev
179+
sudo apt-get install -y build-essential libcurl4-openssl-dev libjansson-dev
177180
autoreconf -fi
178181
./configure
179182
make
180183
```
184+
185+
### Building on Fedora
186+
187+
```
188+
sudo dnf -y install autoconf automake curl-devel jansson-devel
189+
autoreconf -fi
190+
./configure
191+
make
192+
```
193+
194+
### Carbon Aware CLI
195+
196+
To install the SDK CLI you will first need the .NET SDK
197+
198+
* macOS - download and install the (macOS .NET SDK Installer)[https://dotnet.microsoft.com/en-us/download/dotnet/6.0].
199+
* Ubuntu - `sudo apt-get install -y dotnet-sdk-6.0`
200+
* Fedora - `sudo yum -y install dotnet`
201+
202+
Then you will need the *new* CLI redesign
203+
(pull request)[https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/158] branch:
204+
```
205+
curl -LO https://github.com/microsoft/carbon-aware-sdk/archive/refs/heads/162/cli-redesign.tar.gz
206+
tar xf cli-redesign.tar.gz
207+
cd carbon-aware-sdk-162-cli-redesign/src/CarbonAware.CLI/src
208+
```
209+
210+
Update the `appsettings.json`, for example, with your WattTime credentials:
211+
```
212+
vi appsettings.json
213+
{
214+
"Logging": {
215+
"LogLevel": {
216+
"Default": "Information",
217+
"Microsoft.AspNetCore": "Warning"
218+
}
219+
},
220+
"AllowedHosts": "*",
221+
"carbonAwareVars": {
222+
"carbonIntensityDataSource": "WattTime"
223+
},
224+
"wattTimeClient": {
225+
"username": "<watttime username>",
226+
"password": "<watttime password>"
227+
}
228+
}
229+
```
230+
231+
Build a release and test it:
232+
```
233+
dotnet publish -c Release
234+
bin/Release/net6.0/publish/caw emissions -l eastus
235+
```

circa.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ the program will just block until the best time.\n\n",
212212
printf("OPTIONS:\n\
213213
-l <location> specify location to check for carbon intensity\n\
214214
-d <duration> estimated window of runtime of command/task in minutes\n\
215-
-u <api url> url prefix of Carbon Aware API server to consult\n");
215+
-u <api url> url prefix of Carbon Aware API server to consult OR\n\
216+
full path to Carbon Aware CLI executable\n");
216217
}
217218

218219
void format_params(params_t *params, size_t iso8601_size, char *iso8601_format,
@@ -327,6 +328,8 @@ void call_cli(char *cmd, void (*extract_data)(response_t *, void *),
327328
return;
328329
}
329330

331+
printf("OUTPUT: %s", response.text);
332+
330333
extract_data(&response, data);
331334

332335
free(response.text);

circa.conf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
# `/etc/circa.conf` or `~/.circa/config`. The format is key value pairs
66
# separated by a single space.
77

8-
# Url to API endpoint, without trailing slash
8+
# Url to API endpoint, without trailing slash
99
url https://carbon-aware-api.azurewebsites.net
1010

11+
# OR full path to CLI executable
12+
# url /home/circa/carbon-aware-sdk-162-cli-redesign/src/CarbonAware.CLI/src/bin/Release/net6.0/publish/caw
13+
1114
# Location to request carbon intensity data for
1215
location uksouth

0 commit comments

Comments
 (0)