-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fn): run every function in an event loop
And then await it only if the value it returns is awaitable...
- Loading branch information
Showing
5 changed files
with
41 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import pythonmonkey as pm | ||
from dcp import job | ||
import dcp | ||
dcp.init() | ||
|
||
|
||
my_j = job.Job('x=>{progress();return x+x;}', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) | ||
|
||
my_j.on('readystatechange', print) | ||
my_j.on('accepted', lambda: print(my_j.id)) | ||
my_j.on('result', print) | ||
|
||
my_j.computeGroups = [{'joinKey': 'joseph', 'joinSecret': 'pringle'}] | ||
my_j.public.name = 'simple bifrost2 example' | ||
|
||
res = my_j.exec() | ||
|
||
# my_j.exec() | ||
# res = my_j.wait() | ||
|
||
print(">>>>>>>>>>>>>>>>>>>>>>>>>> RESULTS ARE IN") | ||
print(pm.eval('Array.from')(res)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters