task

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

谁说胖子不能爱 提交于 2019-12-06 01:23:35
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_install_queue run, from the object stored in result . Thank you! EDIT: I've changed the tasks to be like:

Deadlock while blocking async HttpClient call within a task continuation

喜欢而已 提交于 2019-12-06 01:21:51
I am trying to wrap my head around synchronously calling async functions and deadlock. In the below example I am blocking an async call which internally uses ConfigureAwait(false) which as far as I can tell should prevent deadlock. The first call to the web service does not deadlock. However, the second one that happens within a continuation that syncs back to the UI thread deadlocks. GetBlocking_Click is a click event in a WPF app so both the first and the second request happen on the UI thread. private void GetBlocking_Click(object sender, RoutedEventArgs e) { const string uri = "http://www

How do I overwrite a task in gradle kotlin-dsl

北城以北 提交于 2019-12-06 00:52:40
In Groovy, I overwrite a task like this: task jar(overwrite: true) { ... } How do I do that with Kotlin-dsl? I know that I can create a task like this: tasks { val jar by creating { ... } } but I can't find the equivalent way to declare it as overwrite, this leads to an error By opening an issue on the kotlin-dsl github I found the correct syntax: tasks.replace("jar") { ... } However, this is the old way and does not work within a tasks { } block, so this issue will be further tracked here 来源: https://stackoverflow.com/questions/48553029/how-do-i-overwrite-a-task-in-gradle-kotlin-dsl

UnobservedTaskException - Where did the task come from

痴心易碎 提交于 2019-12-06 00:33:57
In my MVC application, I sometimes get an exception like: System.Net.WebException: The request was aborted: The request was canceled. at System.Net.HttpWebRequest.BeginGetRequestStream(AsyncCallback callback, Object state) at System.Net.Http.HttpClientHandler.StartGettingRequestStream(RequestState state) at System.Net.Http.HttpClientHandler.<>c__DisplayClass4.<PrepareAndStartContentUpload>b__0(Task task) at System.Threading.Tasks.Task.Execute() --- End of inner exception stack trace --- EDIT Here's another kind I'm seeing: System.Exception: Unhandled Task Error ---> System

Gradle - How to add some delay pause hang in Gradle

独自空忆成欢 提交于 2019-12-06 00:09:28
问题 Im looking for a way to insert a pause of few seconds between the calls of two gradle tasks. I can use firstTask.doLast { ..... } something like which can do Linux/Unix sleep 45 Any ideas? 回答1: First, I'd try to find a better solution than waiting for so long every time. Anyway, to delay the first task for 45 seconds, you can do: firstTask.doLast { sleep(45 * 1000) } A good way to familiarize yourself with Groovy's core APIs is to study the Groovy JDK (also known as GDK). It's also a handy

Safe way to implement a “Fire and Forget” method on ASP.NET Core

大兔子大兔子 提交于 2019-12-05 23:12:11
问题 I am trying to implement a simple logging library which will be used across multiple projects. The job of library is to send HTTP requests to ElasticSearch. The main point of this library is that it must not wait for the response. Also, I don't care about any error/exceptions. It must send the request to ElasticSearch, and immediately return. I don't want to make interfaces with return type Task , I want them to stay void . Below is my sample code. Is it a correct and safe implementation of

What's the best way to wrap a synchronous code as an async Task?

女生的网名这么多〃 提交于 2019-12-05 22:34:48
I am implementing an interface method that is asynchronous (returns Task). However, my implementation is by necessity synchronous. What's the best way to do this? Is there some built-in way to do this? Here are several options I'm considering: Option 1: Task.FromResult return Task.FromResult(ComputeResult()); This is good because my code runs synchronously. The disadvantage is that if ComputeResult() fails or is canceled my method throws instead of returning a failed task. Option 2: Task.Run return Task.Run(() => ComputeResult()); This propagates failure and cancellation more naturally.

Is process name same as package name in android?

拜拜、爱过 提交于 2019-12-05 21:17:58
问题 By process I mean what we provide in android:process and by package I mean package in <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.osg.appkiller" android:versionCode="1" android:versionName="1.0" > More details Processes and Threads - Android Developer I wanted to get application names of all running apps. So this is what I did after looking at various sources (and it works). ActivityManager activityManager = (ActivityManager) getSystemService(Context

How to get returned value of async Task<string> method name()?

纵饮孤独 提交于 2019-12-05 19:51:33
问题 I'm trying to get the return string of my method but the problem is I don't know how can I get the return value from public async Task<string> Login(string username, string password, string site) . This is my codes from Program.cs static void Main(string[] args) { var username = "Leonel.Sarmiento"; var password = "welcome"; var site = "QADBSite"; var url = "na1.sabacloud.com"; ConsoleCustomizer.Spinner Spinner = new ConsoleCustomizer.Spinner("+", "x", "+", "x"); ConsoleCustomizer.TypeWriter

Excel Interop: Creating instance with Task.Run results in exception System.EntryPointNotFoundException

送分小仙女□ 提交于 2019-12-05 19:49:38
Here is my minimal example producing the problem: using System.Runtime.InteropServices; using System.Threading.Tasks; using Excel = Microsoft.Office.Interop.Excel; class Program { static void Main(string[] args) { Task.Run(() => { Excel.Application app = new Excel.Application(); if (app != null) { app.Quit(); Marshal.FinalReleaseComObject(app); app = null; } }); } } This results in the following exception: The last part in Japanese says the "EventSetInformation" of DLL advapi32.dll entry point cannot be found . I'm having difficulty understanding what is going on. Basically why is this