def secureInterruptHandlerScheduler(timer=None): try: # Execute CBF LIST from local cached config with timirqseq in sec scheduler(CFG_TIMER_IRQ[0], CFG_TIMER_IRQ[1]) except Exception as e: console_write("[IRQ] TIMIRQ (cron) callback: {} error: {}".format( CFG_TIMER_IRQ[0], e))
def run(self): if self.zap: X = scheduler() scheduler.run = X cat.coordinatingassistanttracker.basecat.zap() scheduler.run.waitForOne() scheduler.run.runThreads(slowmo=self.slowmo) background.lock.release()
def run(self): if self.zap: X = scheduler() scheduler.run = X cat.coordinatingassistanttracker.basecat.zap() scheduler.run.waitForOne() scheduler.run.runThreads(slowmo = self.slowmo) background.lock.release()
def generateMap(): while True: coordinate=scheduler() coordinates.append(coordinate) print(coordinates) # imported function for calcuating the distance of a person from the objects calculateAndMap(raw_pic,coordinates) # device goes to sleep for an hour 60*60 sleep(60*1)
def run(self): if self.zap: # print "zapping", scheduler.run.threads X = scheduler() scheduler.run = X # print "zapped", scheduler.run.threads cat.coordinatingassistanttracker.basecat.zap() # print "Here? (run)" dummyComponent().activate() # to keep the scheduler from exiting immediately. # print "zoiped", scheduler.run.threads # TODO - what happens if the foreground calls scheduler.run.runThreads() ? We should stop this from happening. scheduler.run.runThreads(slowmo = self.slowmo) # print "There?" background.lock.release()
def enableCron(): """ Set time stump based scheduler aka cron in timer1 Input: cron(bool), cronseq(ms), crontasks(str) """ console_write("[IRQ] CRON IRQ SETUP: {} SEQ: {}".format(cfgget('cron'), cfgget("cronseq"))) console_write("|- [IRQ] CRON CBF:{}".format(cfgget('crontasks'))) if cfgget("cron") and cfgget('crontasks').lower() != 'n/a': from machine import Timer # INIT TIMER 1 IRQ with callback function wrapper lm_str = cfgget('crontasks') sample = int(cfgget("cronseq")/1000) timer = Timer(1) timer.init(period=int(cfgget("cronseq")), mode=Timer.PERIODIC, callback=lambda timer: scheduler(lm_str, sample))
def run(self): if self.zap: # print "zapping", scheduler.run.threads X = scheduler() scheduler.run = X # print "zapped", scheduler.run.threads cat.coordinatingassistanttracker.basecat.zap() # print "Here? (run)" dummyComponent().activate( ) # to keep the scheduler from exiting immediately. # print "zoiped", scheduler.run.threads # TODO - what happens if the foreground calls scheduler.run.runThreads() ? We should stop this from happening. scheduler.run.runThreads(slowmo=self.slowmo) # print "There?" background.lock.release()
# 11/02/2018 # Justin Privitera # Schedule Planner # v1.3 # # Version History: # 10/31/2018 v1.0 added basic functionality # 11/01/2018 v1.1 updated command line args so that they are optional; additionally added a feauture so that the user can limit the results by choosing a number of classes to view # 11/01/2018 v1.2 added ability to curate further by putting in the inFile a certain imperative class such that all results must contain that class. # further added to this feature by allowing the user to choose one class or another to apply the feature to # 11/02/2018 v1.3 removed ability to view all results containing one class OR another and replaced it with viewing all results containing one class AND another # # The purpose is to replace PASS with a superior scheduling applet, with greater functionality and options. # # run the program with the following command: "python3 main.py" or "make" or "make run" import sys from Scheduler import scheduler if len(sys.argv) > 3: print("Too many parameters supplied") elif len(sys.argv) >= 2: if len(sys.argv) == 3: scheduler(int(sys.argv[1]), sys.argv[2]) else: scheduler(int(sys.argv[1])) else: scheduler()
#import nbimporter #if('..' not in sys.path): # sys.path.insert(0,'..') from Task import Task from Scheduler import scheduler destination_pose = rospy.Publisher('destination_pose', Float32MultiArray, queue_size=100) target_current = rospy.Publisher('person_to_find', String, queue_size=100) target_remove = rospy.Publisher('person_to_remove', String, queue_size=100) target_background = rospy.Publisher('background_person', String, queue_size=100) talker = rospy.Publisher('deliver', String, queue_size=100) scheduler = scheduler() current_pos = [0, 0] weight_seenbackgroundTarget = 150 def setCurrentPosition(data): EstimatePosition = data.pose.position current_pos = [EstimatePosition.x, EstimatePosition.y] def createTask(data): parts = data.data.split("|") #print(parts) #taskType, sender, recipient, payLoad, location, modifier task = Task(parts[0], parts[1], parts[2], parts[3], parts[4], int(parts[5]), False, data.data)
if str(message.guild.id) in prefixes: return prefixes[str(message.guild.id)] else: prefixes[str(message.guild.id)] = '!' # Dump the new prefix into the JSON with open('./Config/prefixes.json', 'w') as file: json.dump(prefixes, file, indent=4) # Return the default prefix return '!' # Set Bot command prefix bot = commands.Bot(command_prefix=getPrefix) sched = scheduler() nameGen = markovNameGenerator(2) tz = timezone() async def scheduling_task(): await bot.wait_until_ready() while not bot.is_closed(): await sched.performTasks(bot) # Wait until the next minute await asyncio.sleep(60 - datetime.now().second) @bot.event
def producersConsumersSystemTest(): class Producer(component): Inboxes=[] Outboxes=["result"] def __init__(self): super(producersConsumersSystemTest, self).__init__() def main(self): i = 100 while(i): i = i -1 self.send("hello", "result") yield 1 class Consumer(component): Inboxes=["source"] Outboxes=["result"] def __init__(self): super(Consumer, self).__init__() self.count = 0 self.i = 30 def doSomething(self): print self.name, "Woo",self.i if self.dataReady("source"): self.recv("source") self.count = self.count +1 self.send(self.count, "result") def main(self): yield 1 while(self.i): self.i = self.i -1 self.doSomething() yield 1 class testComponent(component): Inboxes=["_output"] Outboxes=["output"] def __init__(self): super(testComponent, self).__init__() self.lackofinterestingthingscount = 0 self.total = 0 self.producer, self.consumer =Producer(), Consumer() self.producer2, self.consumer2 = Producer(), Consumer() self.addChildren(self.producer, self.producer2, self.consumer, self.consumer2) self.link((self.producer, "result"), (self.consumer, "source")) linkage(self.producer2, self.consumer2, "result", "source", self.postoffice) linkage(self.consumer,self,"result","_output", self.postoffice) linkage(self.consumer2,self,"result","_output", self.postoffice) def childComponents(self): return [self.producer, self.consumer,self.producer2, self.consumer2] def mainBody(self): if len(self.inboxes["_output"]) > 0: result = self.recv("_output") self.total = self.total + result print "Result recieved from consumer : ", result, "!" print "New Total : ", self.total, "!" else: self.lackofinterestingthingscount = self.lackofinterestingthingscount +1 if self.lackofinterestingthingscount > 2: print "Exiting. Nothing interesting for ", self.lackofinterestingthingscount, " iterations" return 0 return 1 r = scheduler() p = testComponent() children = p.childComponents() p.activate() for p in children: p.activate() scheduler.run.runThreads(slowmo=0)# context = r.runThreads()
def producersConsumersSystemTest(): class Producer(component): Inboxes = [] Outboxes = ["result"] def __init__(self): super(producersConsumersSystemTest, self).__init__() def main(self): i = 100 while (i): i = i - 1 self.send("hello", "result") yield 1 class Consumer(component): Inboxes = ["source"] Outboxes = ["result"] def __init__(self): super(Consumer, self).__init__() self.count = 0 self.i = 30 def doSomething(self): print self.name, "Woo", self.i if self.dataReady("source"): self.recv("source") self.count = self.count + 1 self.send(self.count, "result") def main(self): yield 1 while (self.i): self.i = self.i - 1 self.doSomething() yield 1 class testComponent(component): Inboxes = ["_output"] Outboxes = ["output"] def __init__(self): super(testComponent, self).__init__() self.lackofinterestingthingscount = 0 self.total = 0 self.producer, self.consumer = Producer(), Consumer() self.producer2, self.consumer2 = Producer(), Consumer() self.addChildren(self.producer, self.producer2, self.consumer, self.consumer2) self.link((self.producer, "result"), (self.consumer, "source")) linkage(self.producer2, self.consumer2, "result", "source", self.postoffice) linkage(self.consumer, self, "result", "_output", self.postoffice) linkage(self.consumer2, self, "result", "_output", self.postoffice) def childComponents(self): return [ self.producer, self.consumer, self.producer2, self.consumer2 ] def mainBody(self): if len(self.inboxes["_output"]) > 0: result = self.recv("_output") self.total = self.total + result print "Result recieved from consumer : ", result, "!" print "New Total : ", self.total, "!" else: self.lackofinterestingthingscount = self.lackofinterestingthingscount + 1 if self.lackofinterestingthingscount > 2: print "Exiting. Nothing interesting for ", self.lackofinterestingthingscount, " iterations" return 0 return 1 r = scheduler() p = testComponent() children = p.childComponents() p.activate() for p in children: p.activate() scheduler.run.runThreads(slowmo=0) # context = r.runThreads()
from InteractUser import interactUser from Scheduler import scheduler # Get the university list from db. # Take the input from the as a choice of university with available scheduling time interact = interactUser() #read schedule time from db spiderPath = interact.getUniversityScheduledTime() #following =involves user selection. #universityList=interact.getUniversityList() #spiderPath=interact.getUniversityChoice(universityList) schedule = scheduler() for x in spiderPath.items(): spiderModulePath = x[0].split('.')[0] spiderClass = x[0].split('.')[1] schedule.addJob(spiderModulePath, spiderClass, x[1]) schedule.runJob() """ process = CrawlerProcess() process.crawl(uToronto.UtorontoSpider) process.start() """ #logging.basicConfig(filename='Log.txt',level=logging.DEBUG) """ runner = CrawlerRunner() d = runner.crawl(uToronto.UtorontoSpider)