task

Writing XML data from URL to Object in SSIS Script Task

南笙酒味 提交于 2019-12-09 13:54:01
问题 I have this URL where there is XML data. I have to extract that data from URL and dump it into DW table. I am using SSIS Script Task for that. This is how the data looks like: -<currency> <csymbol>AED</csymbol> <cname>United Arab Emirates Dirhams</cname> <crate>3.6732001305</crate> <cinverse>0.2722421770</cinverse> </currency> −<currency> <csymbol>AFN</csymbol> <cname>Afghanistan Afghanis</cname> <crate>44.0000000000</crate> <cinverse>0.0227272727</cinverse> </currency> −<currency> <csymbol

A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property

為{幸葍}努か 提交于 2019-12-09 13:30:12
问题 These are my tasks. How should i modify them to prevent this error. I checked the other similar threads but i am using wait and continue with. So how come this error happening? A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. var CrawlPage = Task.Factory.StartNew(() => { return crawlPage(srNewCrawledUrl, srNewCrawledPageId, srMainSiteId); }); var GetLinks =

Cleaning up CallContext in TPL

荒凉一梦 提交于 2019-12-09 09:06:47
问题 Depending on whether I'm using async/await based code or TPL based code, I'm getting two different behaviors regarding the clean-up of logical CallContext . I can set and clear logical CallContext exactly as I expect if I use the following async/await code: class Program { static async Task DoSomething() { CallContext.LogicalSetData("hello", "world"); await Task.Run(() => Debug.WriteLine(new { Place = "Task.Run", Id = Thread.CurrentThread.ManagedThreadId, Msg = CallContext.LogicalGetData(

ansible ignore the run_once configuration on task

随声附和 提交于 2019-12-09 08:31:45
问题 I am using Ansible and I want to run a task only once. I follow the documentation about how to configure and run a task only once - name: apt update shell: apt-get update run_once: true But when I run Ansible, it always runs this task. How can I run my task only once. 回答1: The run_once option will run every time your Playbook/tasks runs, but will only run it once during the specific run itself. So every time you run the play, it will run, but only on the first host in the list. If you're

How to pass LongRunning flag specifically to Task.Run()?

半腔热情 提交于 2019-12-09 08:25:39
问题 I need a way to set an async task as long running without using Task.Factory.StartNew(...) and instead using Task.Run(...) or something similar. Context: I have Task that loops continuously until it is externally canceled that I would like to set as 'long running' (i.e. give it a dedicated thread). This can be achieved through the code below: var cts = new CancellationTokenSource(); Task t = Task.Factory.StartNew( async () => { while (true) { cts.Token.ThrowIfCancellationRequested(); try {

is returning an empty static task in TPL a bad practice?

五迷三道 提交于 2019-12-09 08:13:55
问题 There are cases that I would want to run a task conditionally. I use some sort of extension method like this: public static class MyTaskExtension{ private static Task theEmptyTask = Task.Factory.StartNew(() => {}); //This is the question public static Task ContinueWith(this Task task, Task continuationTask, Func<bool> condition) { if condition(){ ... do the work } return theEmptyTask; } } My expectation is that theEmptyTask would be already completed, so basically if I don't want to do

Is catching TaskCanceledException and checking Task.Canceled a good idea?

限于喜欢 提交于 2019-12-09 07:50:29
问题 There are some people on my team who really love coding with async Task . And sometimes they like to use CancellationToken parameters. What I'm unsure about is whether we should as a team be using this style of code (A): async Task<someObject> DoStuff(CancellationToken t) { while (!t.IsCanceled) { try { Task.Delay(5000, t); } catch (AggregateException e) // or is it TaskCanceledException or OperationCanceledException? I don't know? :) { } // poll something, return someObject, or null } return

How can I pass named arguments to a Rake task?

寵の児 提交于 2019-12-09 07:41:12
问题 Is there a way to pass named arguments to a Rake task without using environment variables? I am aware that Rake tasks can accept arguments in two formats: Environment Variables $ rake my_task foo=bar This creates an environment variable with the name foo and the value bar that can be accessed in the Rake task my_task by ENV['foo'] . Rake Task Arguments $ rake my_task['foo','bar'] This passes the values foo and bar to the first two task arguments (if they are defined). If my_task were defined

How to perform tasks avoiding the user being forced to wait the response?

隐身守侯 提交于 2019-12-09 07:33:31
问题 After user created a new product, in my application then I do several operation like update few tables: stats, financial, usage, stock, etc. Now users must wait for I've finished all steps. If a lot of user tray do it at the same time then time to wait is much more and that's not so good. My plan is to create a special TASK_TABLE (product_id, time, task_id) and then run this tasks in background BUT: oldest first, don't stop user for next action, run this tasks as quickly as possible. How can

Cancel task by time

天涯浪子 提交于 2019-12-09 03:34:07
问题 I have a multi-threaded application where I need to cancel each task after a certain time, even if at the time of cancellation, they use unmanaged resources. Now I use the following code (for example, a console application). In a real application, the delay may occur in the unmanaged resource. static void Main() { for (int i = 0; i < 10; i++) { Task.Factory.StartNew(Do, TaskCreationOptions.LongRunning); } Console.ReadLine(); } private static void Do() { new Timer(Thread.CurrentThread.Abort,