Skip to content

Instantly share code, notes, and snippets.

@sadjad
Last active September 12, 2018 21:03
Show Gist options
  • Save sadjad/5ed8347686ad34a4b829fe6572edf84d to your computer and use it in GitHub Desktop.
Save sadjad/5ed8347686ad34a4b829fe6572edf84d to your computer and use it in GitHub Desktop.
#!/bin/bash
gg-init
gcc -o sleeper sleeper.c -static
gg-collect sleeper
for i in $(seq 1 1000)
do
gg-create-thunk --executable $(gg-hash sleeper) --output output --placeholder ${i}.out $(gg-hash sleeper) sleeper ${i}
done
time gg-force --no-download --jobs 1000 --engine lambda --status --timeout 3 *.out
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
int main()
{
int fd = open( "output", O_WRONLY | O_CREAT | O_TRUNC, 0666 );
close( fd );
sleep( 2 );
return 0;
}
#!/usr/bin/env python3
import time
import pywren
def f(x):
time.sleep(2)
return x
wrenexec = pywren.default_executor()
futures = wrenexec.map(f, range(1000))
print(pywren.get_all_results(futures))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment