Buckets:

download
raw
1.47 kB
import time
import csp
from csp import ts
from csp_gateway import GatewayModule, get_thread
__all__ = (
"CspDieModule",
"LongStartModule",
"NeverDieModule",
)
def _never_die():
while True:
try:
print("here")
time.sleep(1)
except: # noqa: E722
...
class NeverDieModule(GatewayModule):
def connect(self, *args, **kwargs) -> None:
self._thread = get_thread(target=_never_die)
self._thread.start()
class CspDieModule(GatewayModule):
count: int = 5
channel_to_access: str = "example"
attribute_to_access: str = "blerg"
def connect(self, channels) -> None:
self._tick(channels.get_channel(self.channel_to_access))
@csp.node
def _tick(self, thing: ts[object]):
with csp.state():
s_counter = 0
if csp.ticked(thing):
s_counter += 1
if s_counter >= self.count:
print("running getter to trigger problem")
getattr(thing, self.attribute_to_access)
class LongStartModule(GatewayModule):
sleep: int = 5
channel_to_access: str = "example"
def connect(self, channels) -> None:
time.sleep(self.sleep)
self._tick(channels.get_channel(self.channel_to_access))
@csp.node
def _tick(self, thing: ts[object]):
with csp.start():
time.sleep(self.sleep)
if csp.ticked(thing):
print("do nothing")

Xet Storage Details

Size:
1.47 kB
·
Xet hash:
db0baa17f25fa2990b191be7cd058ce3dfc46db1d213e5b9cacfa8c51cf12922

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.