task

Setting timeout option for Script Task in SSIS

假装没事ソ 提交于 2019-12-07 10:26:31
问题 I have a script task that executes a dynamically created SQL restore statement. This has worked without a problem for the first 6 runs, but then the .bak files grew too large to run in under 30 sec. I have looked everywhere I can think of for a timeout option. I have reset the Connection Manager's General Timeout to 500 (from what I understand that is in seconds). None of this has worked yet. Where / how do I set this value (or can I)? BIDS Version Info: Microsoft Visual Studio 2008 Version 9

How to get effect of Task.WhenAny for a Task and CancellationToken?

本小妞迷上赌 提交于 2019-12-07 10:18:47
问题 I have interactive task which in "worst" scenario is not executed at all, thus it is represented by TaskCompletionSource . I would like to wait for either this task completes, or token which I received is cancelled -- whichever happens first. Perfect tool for such job would be Task.WhenAny , the only problem is it takes only tasks, and I have one Task and one CancellationToken . How to wait (asynchronously, like Task.WhenAny ) for the first event triggered -- completed task, or cancelled

How to get the information of transitive dependencies in a gradle task?

不打扰是莪最后的温柔 提交于 2019-12-07 09:46:25
问题 I want to get information of all dependencies (including transitive ones) in a gradle task. I tried the code: class MyGradlePlugin implements Plugin<Project> { void apply(Project project) { project.afterEvaluate { println " Project:" + project.name project.configurations.each { conf -> println " Configuration: ${conf.name}" conf.allDependencies.each { dep -> println " ${dep.group}:${dep.name}:${dep.version}" } } } } } But it only prints the declared ones, no transitive ones. That means, if my

Run rake task from outside RAILS_ROOT

一个人想着一个人 提交于 2019-12-07 09:18:07
问题 My RAILS_ROOT is /usr/local/www/application/ If I run 'rake db:migrate RAILS_ENV=production" from within the RAILS_ROOT it works fine. However I can't seem to find a way to run the same command from outside the RAILS_ROOT. 回答1: Try: rake -f $RAILS_ROOT/Rakefile db:migrate RAILS_ENV=production # Assuming you set the environment variable. # Else, just replace $RAILS_ROOT by actual value 回答2: I think you need to re-think your question. When running rake without specifying a rakefile, it's going

Synchronizing events from different threads in console application

倖福魔咒の 提交于 2019-12-07 08:10:52
问题 I am feeling like a total noob asking this, but anyway, here it goes: I was wondering what the easiest way of synchronizing events from different threads is. Some sample code: class Program { static void Main(string[] args) { Console.WriteLine("# started on:" + Thread.CurrentThread.ManagedThreadId); tt t = new tt(); t.First += new EventHandler(t_First); t.Second += new EventHandler(t_Second); Task task = new Task(new Action(t.Test)); task.Start(); while (true) { Console.ReadKey(); Console

What should an async method do if a Task is conditionally executed?

落爺英雄遲暮 提交于 2019-12-07 06:59:13
问题 Suppose I have a method that awaits a Task. This method also returns a Task. For example: public async virtual Task Save(String path) { if (NewWords.Any()) { await FileManager.WriteDictionary(path, NewWords, true); } else await Task.Run(() => { }); } Is the else await Task.Run(() => { }); necessary here or am I free to leave it? Is there any difference if it is present/absent? Maybe there is some other approach to this I should take? 回答1: It's worse than unnecessary, as you're spinning up a

How do do an async ServiceController.WaitForStatus?

£可爱£侵袭症+ 提交于 2019-12-07 06:44:46
问题 So ServiceController.WaitForStatus is a blocking call. How can it be done Task/Async manner? 回答1: The code for ServiceController.WaitForStatus is: public void WaitForStatus(ServiceControllerStatus desiredStatus, TimeSpan timeout) { DateTime utcNow = DateTime.UtcNow; this.Refresh(); while (this.Status != desiredStatus) { if (DateTime.UtcNow - utcNow > timeout) { throw new TimeoutException(Res.GetString("Timeout")); } Thread.Sleep(250); this.Refresh(); } } This can be converted to a task based

JavaFX Task threads not terminating

我们两清 提交于 2019-12-07 06:10:24
问题 I am writing a JavaFX application and my objects extend Task to provide concurrency away from the JavaFX GUI thread. My Main class looks like this: public class MainApp extends Application { @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("Sample.fxml")); Scene scene = new Scene(root); stage.setScene(scene); stage.setOnCloseRequest(new EventHandler<WindowEvent>() { public void handle(WindowEvent t) { //I have put this in to

Silent exceptions in Task.Factory.StartNew when using a long running background consumer task?

和自甴很熟 提交于 2019-12-07 05:41:01
问题 This notifies of an unhandled exception: new Thread(_ => { throw new Exception(); }).Start(); This does not (at least until you wait/retrieve the result): Task.Factory.StartNew(() => { throw new Exception(); }); Why? What has happened to the thread on which the exception was thrown? Does it die? This is a problem where you run a task but don't need its result, or need to wait on it, like this: _operationQueue = new BlockingCollection<Operation>(); Task.Factory.StartNew(() => { foreach (var

WPF asynchronous Task<T> blocking UI

左心房为你撑大大i 提交于 2019-12-07 05:21:22
问题 I already worked with Task type. And all was good while Task return nothing. For example: XAML: <Button Name="_button" Click="ButtonBase_OnClick"> Click </Button> CodeBehind: private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { _button.IsEnabled = false; Task.Factory.StartNew(() => { Thread.Sleep(5*1000); Dispatcher.Invoke(new Action(() => _button.IsEnabled = true)); }); } This works fine. But I want to Task returns some value, for example Boolean . So I need to use Task