scheduler

AttributeError: Can't pickle local object 'computation.. function1 using multiprocessing queue

时光毁灭记忆、已成空白 提交于 2019-11-28 14:27:28
I have the following code using the scheduler and multiprocessing module: def computation(): def function1(q): while True: daydate = datetime.now() number = random.randrange(1, 215) print('Sent to function2: ({}, {})'.format(daydate, number)) q.put((daydate, number)) time.sleep(2) def function2(q): while True: date, number = q.get() print("Recevied values from function1: ({}, {})".format(date, number)) time.sleep(2) if __name__ == "__main__": q = Queue() a = Process(target=function1, args=(q,)) a.start() b = Process(target=function2, args=(q,)) b.start() a.join() b.join() schedule.every()

SLURM `srun` vs `sbatch` and their parameters

女生的网名这么多〃 提交于 2019-11-28 14:05:55
问题 I am trying to understand what the difference is between SLURM's srun and sbatch commands. I will be happy with a general explanation, rather than specific answers to the following questions, but here are some specific points of confusion that can be a starting point and give an idea of what I'm looking for. According to the documentation, srun is for submitting jobs, and sbatch is for submitting jobs for later execution, but the practical difference is unclear to me, and their behavior seems

Java - IO bound thread - 1:1 threading model

耗尽温柔 提交于 2019-11-28 13:06:26
问题 In the below program, //Producer - IO bound public class FileCrawler implements Runnable{ private final BlockingQueue<File> fileQueue; private final File root; .... public void run(){ try{ crawl(root); // IO bound }catch(InterruptedException e){ Thread.currentThread().interrupt(); } } private void crawl(File root) throws InterruptedException{ File[] entries = root.listFiles(fileFilter); ... for(File entry: entries){ fileQueue.put(entry); } } } //Consumer - CPU bound public class Indexer

Parameterize EJB scheduler with Schedule Expression

僤鯓⒐⒋嵵緔 提交于 2019-11-28 09:44:14
问题 I am using EJB 3.1 and jboss-eap-6.4 and I want to set some dynamic parameters for hour, minute and second of ejb scheduler as follows: Non-parametric code - which run in 30th second of every 5 minutes : @Singleton @Startup public class TriggerJob { @EJB //some db injections @PostConstruct public void onStartup() { try { preparation(); } catch (CertificateVerificationException e) { e.printStackTrace(); } } @Schedule(second = "30", minute = "*/5", hour = "*", persistent = false) public void

How to execute a method in Asp.net MVC for every 24 hours

天大地大妈咪最大 提交于 2019-11-28 08:44:54
I have method in MVC like public void Sendmails() { //sending mails for every 24 hours. } Can I schedule above method to execute for every 24 hours. I know we can set schedule with sql server agent and windows task scheduler . But due to some issues i want to execute current dll only, is this possible in MVC? Possible? Perhaps, with a bit of hacking on invoking tasks and background threads. Reliable? Not in the slightest. A web application is essentially a request-response system. The application receives a request, performs its logic, and returns a response. Beyond that, it's idle. And it's

Request admin privileges for Java app on Windows Vista

╄→гoц情女王★ 提交于 2019-11-28 08:38:17
When I try to create a new task in the task scheduler via the Java ProcessBuilder class I get an access denied error an Windows Vista. On XP it works just fine. When I use the "Run as adminstrator" option it runs on Vista as well.. However this is a additional step requeried an the users might not know about this. When the user just double clicks on the app icon it will fail with access denied. My question is how can I force a java app to reuest admin privileges right after startup? I'm not sure you can do it programmatically. If you have an installer for your app, you can add the registry key

Java scheduler which is completely independent of system time changes

半世苍凉 提交于 2019-11-28 07:33:56
Was using Java Timer, Then switched to ScheduledExecutorService, but my problem is not fixed. As Tasks scheduled before system time change (through ntpd) are not executed on delay specified. Have no logs for same as nothing happens :(. using jre 1.6.0_26 64 bit in my target on 64 bit linux. Update: ScheduledExecutorService works fine on Windows. Problem is only on 64 bit Linux based system running 64 bit JVM. It works fine on 64 bit linux running 32 bit JVM...strange. Have not found any reference of same on any blogs either. IBM's JAVA SDK has same problem (ibm-java-sdk-7.0-0.0-x86_64-archive

Locking a method in Python?

ぐ巨炮叔叔 提交于 2019-11-28 04:12:34
问题 Here is my problem: I'm using APScheduler library to add scheduled jobs in my application. I have multiple jobs executing same code at the same time, but with different parameters. The problem occurs when these jobs access the same method at the same time which causes my program to work incorrectly. I wanna know if there is a way to lock a method in Python 3.4 so that only one thread may access it at a time? If so, could you please post a simple example code? Thanks. 回答1: You can use a basic

How can I see which CPU core a thread is running in?

∥☆過路亽.° 提交于 2019-11-28 03:27:39
In Linux, supposing a thread's pid is [pid], from the directory /proc/[pid] we can get many useful information. For example, these proc files, /proc/[pid]/status,/proc/[pid]/stat and /proc/[pid]/schedstat are all useful. But how can I get the CPU core number that a thread is running in? If a thread is in sleep state, how can I know which core it will run after it is scheduled again? BTW, is there a way to dump the process(thread) list of running and sleeping tasks for each CPU core? David Schwartz The answer below is no longer accurate as of 2014 Tasks don't sleep in any particular core. And

How to check event scheduler status mysql

…衆ロ難τιáo~ 提交于 2019-11-28 02:37:30
问题 In MySQL, we can enable the event scheduler by following query: SET GLOBAL event_scheduler = ON; Similarly, to turn off the scheduler: SET GLOBAL event_scheduler = OFF; But, Is there any query/way to check the status of this event_scheduler whether it's on or off? 回答1: Use SHOW VARIABLES SHOW VARIABLES WHERE VARIABLE_NAME = 'event_scheduler' 回答2: This should also work: select @@global.event_scheduler = 'ON' That is a little easier to use in a stored procedure, where you might want to know if