-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathphases_asyncio.py
More file actions
57 lines (45 loc) · 1.55 KB
/
Copy pathphases_asyncio.py
File metadata and controls
57 lines (45 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import experiment as exp
import asyncio
# TODO: add async action
class AsyncPhasesExperiment(exp.Experiment):
default_params = {
"run_msg": "TestExperiment is running",
"end_msg": "TestExperiment has ended",
}
async def setup(self):
self.log.info("setup")
await asyncio.sleep(1)
self.log.info(".")
self.actions["Run me"] = {"run": self.run_me}
async def run_me(self):
self.log.info("async")
await asyncio.sleep(1)
self.log.info("action")
async def run_trial(self):
self.log.info(f"run trial: {exp.session_state['cur_trial']}")
await asyncio.sleep(1)
self.log.info(".")
async def run_block(self):
self.log.info(f"run block: {exp.get_params()['run_msg']}")
await asyncio.sleep(1)
self.log.info(".")
async def run(self):
self.log.info(f"run: {exp.get_params()['run_msg']}")
await asyncio.sleep(1)
self.log.info(".")
async def end(self):
self.log.info(f"end: {exp.get_params()['end_msg']}")
await asyncio.sleep(1)
self.log.info(".")
async def end_block(self):
self.log.info(f"end block: {exp.get_params()['end_msg']}")
await asyncio.sleep(1)
self.log.info(".")
async def end_trial(self):
self.log.info(f"trial {exp.session_state['cur_trial']} ended")
await asyncio.sleep(1)
self.log.info(".")
async def release(self):
self.log.info("release")
await asyncio.sleep(1)
self.log.info(".")