Skip to content

Commit 1dbe87a

Browse files
authored
Fix upload user and state test function (#83)
* Fix upload user * Increment func to use counter * Formatting
1 parent 790f17f commit 1dbe87a

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

func/demo/increment.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,28 @@
55

66
#include <stdio.h>
77

8+
#define KEY "incr_example"
9+
#define N_WORKERS 4
10+
11+
int checkCount()
12+
{
13+
faasm::incrementCounter(KEY);
14+
return 0;
15+
}
16+
817
int main(int argc, char* argv[])
918
{
10-
const char* key = "incr_example";
19+
faasm::initCounter(KEY);
1120

12-
faasm::incrementCounter(key);
13-
faasmPushState(key);
21+
// Dispatch chained calls
22+
faasmChainBatch(checkCount, "", N_WORKERS);
1423

15-
int count = faasm::getCounter(key);
24+
int count = faasm::getCounter(KEY);
1625

17-
// Return message
18-
char output[13];
19-
sprintf(output, "Counter: %03i", count);
20-
faasmSetOutput((uint8_t*)output, 12);
26+
if (count != N_WORKERS) {
27+
printf("Count not as expected: %i != %i\n", count, N_WORKERS);
28+
return 1;
29+
}
2130

2231
return 0;
2332
}

tasks/func.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,9 @@ def upload_user(ctx, user):
9393
"""
9494
Upload all compiled functions for a user
9595
"""
96-
host, port = get_faasm_upload_host_port()
9796
funcs = _get_all_user_funcs(user)
9897
for f in funcs:
99-
upload(ctx, user, f, host=host, port=port)
98+
upload(ctx, user, f)
10099

101100

102101
@task

0 commit comments

Comments
 (0)