task

Generating more tasks than there are threads

纵饮孤独 提交于 2020-01-15 04:59:33
问题 I read in several OpenMP tutorials that you should not generate more tasks than there are threads. For example: "Do not start more tasks than there are available threads, which means available in the enclosing parallel region." Assume that we want to traverse a binary tree, that the subtrees of a node can be traversed in parallel, and that our machine has four cores. Following the advice above, we generate two tasks at the root, one for the left and one for the right subtree. Within both

python script won't finish in task scheduler

Deadly 提交于 2020-01-15 04:54:12
问题 I have the following python script below that will execute if I run the module manually, but when I try to schedule it in Windows Task Scheduler, it doesn't finish. I have a log file being exported as part of the script and it prints down to 'Start Time' but doesn't make it to 'End Time' which seems to suggest it's getting stuck on the copy function. Task scheduler settings: 1) Run whether user is logged on or not 2) Run with highest privileges import os import sys import shutil import glob

where the heck is org.hibernate.tool.ant.HibernateToolTask?

人盡茶涼 提交于 2020-01-14 07:30:09
问题 Where the heck do I get org.hibernate.tool.ant.HibernateToolTask ? I can't seem to find a .jar file that contains it. 回答1: Download Hibernate Tools - it's in hibernate-tools.jar located in plugins\org.hibernate.eclipse_3.2.4.CR2-R200901280154\lib\tools 回答2: I got the latest (hibernate 4) version of hibernate-tools.jar ( hibernate-tools-4.3.1.Final.jar ) like this: Get the jar for Hibernate tools v. 4.3.1: Dowload JBossTools 4.3.0 from http://tools.jboss.org/downloads/jbosstools/mars/4.3.0

Age of a process in the Linux kernel

强颜欢笑 提交于 2020-01-14 05:42:29
问题 Given the struct task_struct to work with. What's the best way to determine how old a process is? The task_struct is used to hold specific pointers to it's next youngest sibling, and oldest child. That no longer seems to be available in some kernel versions. I'm specifically using the Android goldfish kernel. I've been trying to learn how to use the list_head structure to iterate over processes, but I can't seem to figure out how to determine the age of each child or sibling process. So, what

how to get the queue in which a task was run - celery

两盒软妹~` 提交于 2020-01-13 14:05:12
问题 I'm new using celery and have a question. I have this simple task: @app.task(name='test_install_queue') def test_install_queue(): return subprocess.call("exit 0",shell=True) and I am calling this task later in a test case like result = tasks.test_default_queue.apply_async(queue="install") The task run successfully in the queue install (because I am seeing it in the celery log, and it completes fine. But I would like to know a programmatically way of finding in which queue was the task test

how to get the queue in which a task was run - celery

℡╲_俬逩灬. 提交于 2020-01-13 14:04:20
问题 I'm new using celery and have a question. I have this simple task: @app.task(name='test_install_queue') def test_install_queue(): return subprocess.call("exit 0",shell=True) and I am calling this task later in a test case like result = tasks.test_default_queue.apply_async(queue="install") The task run successfully in the queue install (because I am seeing it in the celery log, and it completes fine. But I would like to know a programmatically way of finding in which queue was the task test

Why is the call ambiguous? 'Task.Run(Action)' and 'Task.Run(Func<Task>)'

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-13 07:38:06
问题 Considering the following code: public void CacheData() { Task.Run((Action)CacheExternalData); Task.Run(() => CacheExternalData()); Task.Run(CacheExternalDataTask); Task.Run(CacheExternalData); } public Task CacheExternalDataTask() { // Long running code return Task.FromResult("Data"); } public void CacheExternalData() { // Long running code } Why is Task.Run(CacheExternalData) ambiguous ? And Task.Run(CacheExternalDataTask) is not ? When calling Task.Run with CacheExternalData I would have

Keep android alarms alive, even after process killed by a task manager

安稳与你 提交于 2020-01-13 03:24:22
问题 I am writing an alarm program. My problem is task managers, like advanced task manager or Samsung task manager, remove my alarms when clearing memory. Is there any way of preventing task managers from removing my alarms? Or a way to be notified of "clear memory" and forcing app to recreate alarms again. 回答1: In short, no. You can re-register your alarms when the user starts your app again, or when the phone is rebooted. 来源: https://stackoverflow.com/questions/7551287/keep-android-alarms-alive

How can I feed commands to cmd.exe process via an input stream manually?

心不动则不痛 提交于 2020-01-11 14:45:13
问题 The question sounds a bit, dense. Here is a slightly longer version: I need to have the main loop wait for user input and also have a process running and waiting for input from a stream to which the user input is to be sent. Full story: I'm building a Cmd emulator and at first everything looked fine: The user enters a command, it gets echoed to the output area, processed and StdOut and StdErrOut are captured and also added to the output TextBox. The only problem was, that, as the cmd process

CancellationTokenSource.CancelAfter not working

安稳与你 提交于 2020-01-11 09:45:52
问题 I'm trying to implement some retry logic base on this post (but with tasks) Cleanest way to write retry logic? The idea for the retry logic is to then to implement a second task that triggers the cancelation after a give amount of time void Main() { RetryAction(() => Sleep(), 500); } public static void RetryAction(Action action, int timeout) { var cancelSource = new CancellationTokenSource(); cancelSource.CancelAfter(timeout); Task.Run(() => action(), cancelSource.Token); } public static void