Opened 3 years ago

Closed 3 weeks ago

#2258 closed enhancement (done)

Executable.Start executes it asynchronously

Reported by: mkommend Owned by: jkarder
Priority: medium Milestone: HeuristicLab 3.3.15
Component: Optimization Version: 3.3.10
Keywords: Cc:

Description

While the name suggests that this method is executed synchronously, it runs in fact asynchronously. Hence, in every script and program code synchronization mechanisms must be used to wait until the executable is finished. It would be better to have a separate way to start the executable in a synchronous way.

The standard in the .NET framework is that asynchronous methods have the postfix async attached to the method name, which would lead to the two methods Start and StartAsync. Though, changing the semantics of Start from asynchronous to synchronous execution would require lots of code changes and break existing script. Maybe, it would be better to add a method StartSync to the executable interface.

Change History (39)

comment:1 Changed 3 years ago by swagner

  • Milestone changed from HeuristicLab 3.3.x Backlog to HeuristicLab 3.3.11
  • Owner changed from architects to swagner
  • Status changed from new to assigned

comment:2 Changed 3 years ago by ascheibe

I think we should make this change after switching to .NET4.5 and then add a StartAsync Method which adhears to the TAP. We could maybe then even return Task<ResultCollection>?

Last edited 3 years ago by ascheibe (previous) (diff)

comment:3 Changed 3 years ago by swagner

r11614: Created branch Async

comment:4 Changed 3 years ago by swagner

r11641: Deleted branch Async

comment:5 Changed 3 years ago by swagner

r11642: Created branch Async again in order to include latest changes regarding the switch to .NET 4.5

comment:6 Changed 3 years ago by ascheibe

  • Milestone changed from HeuristicLab 3.3.11 to HeuristicLab 3.3.12

comment:7 Changed 2 years ago by ascheibe

  • Milestone changed from HeuristicLab 3.3.12 to HeuristicLab 3.3.13

comment:8 Changed 21 months ago by ascheibe

  • Milestone changed from HeuristicLab 3.3.13 to HeuristicLab 4.0

comment:9 Changed 21 months ago by jkarder

  • Owner changed from swagner to jkarder
  • Status changed from assigned to accepted

comment:10 Changed 21 months ago by jkarder

r13328: deleted branch Async

comment:11 Changed 21 months ago by jkarder

r13329: created branch Async

comment:12 Changed 21 months ago by jkarder

r13349: added StartAsync to IExecutable

comment:13 Changed 21 months ago by jkarder

r13354: improved cancellation support

comment:14 Changed 21 months ago by jkarder

r13355: updated unit test utils

comment:15 Changed 19 months ago by ascheibe

  • Owner changed from jkarder to ascheibe
  • Status changed from accepted to reviewing

comment:16 Changed 14 months ago by ascheibe

  • Owner changed from ascheibe to mkommend

comment:17 Changed 9 months ago by jkarder

  • Milestone changed from HeuristicLab 4.0 to HeuristicLab 3.3.15
  • Owner changed from mkommend to abeham

comment:18 Changed 8 weeks ago by jkarder

  • Owner changed from abeham to jkarder
  • Status changed from reviewing to assigned

comment:19 Changed 8 weeks ago by jkarder

  • Status changed from assigned to accepted

comment:20 Changed 8 weeks ago by jkarder

r15065: refactored async methods

  • synchronously called IExecutables are now executed in the caller's thread
  • removed old synchronization code from unit tests

comment:21 Changed 7 weeks ago by jkarder

  • Owner changed from jkarder to abeham
  • Status changed from accepted to reviewing

comment:22 Changed 5 weeks ago by abeham

r15190: fixed starting of cloned algs

comment:23 Changed 5 weeks ago by abeham

r13349: ok r13354: ok r13355: ok r15065:

  • Instead of writing await Task.Factory.StartNew((ct) => Start((CancellationToken)ct), cancellationToken, cancellationToken); would it be feasible to write await Task.Run(() => Start(cancellationToken), cancellationToken); ?

The rest seems ok.

comment:24 Changed 5 weeks ago by jkarder

r15204: worked on execution of cross-validation

comment:25 Changed 5 weeks ago by mkommend

Tested new changes in CV and still encountered some problems. Frenetically clicking the execution buttons, starts/pauses/stops the CV multiple times which results in strange behavior and brings the GUI out of sync with the content.

Handling of exceptions works fine in my opinion.

The branch has to be updated with the most recent trunk changes.

comment:26 Changed 5 weeks ago by jkarder

r15212: worked on execution of cross-validation

comment:27 Changed 5 weeks ago by jkarder

r15215: worked on execution of basic algorithm

comment:28 Changed 5 weeks ago by jkarder

r15216: reset startPending if an exception is thrown before OnStarted is called

comment:29 Changed 5 weeks ago by jkarder

r15232: worked on exception handling

comment:30 Changed 4 weeks ago by abeham

r15280: merged r13329:14000 from trunk into branch

comment:31 Changed 4 weeks ago by abeham

r15281: merged r14001:15280 from trunk into branch

comment:32 Changed 3 weeks ago by jkarder

r15284: worked on basic algorithm and cross-validation

comment:33 Changed 3 weeks ago by abeham

  • Owner changed from abeham to jkarder
  • Status changed from reviewing to assigned

I reviewed the changes and tested this in the GUI extensively. Please merge this into the trunk.

comment:34 Changed 3 weeks ago by jkarder

r15286: updated mergeinfo

comment:35 Changed 3 weeks ago by jkarder

  • Owner changed from jkarder to abeham
  • Status changed from assigned to reviewing

r15287: merged Async branch into trunk

comment:36 Changed 3 weeks ago by jkarder

r15290: fixed MultiTrajectoryAnalysis (change relevant for #1696)

Last edited 3 weeks ago by abeham (previous) (diff)

comment:37 Changed 3 weeks ago by abeham

  • Owner changed from abeham to jkarder
  • Status changed from reviewing to readytorelease

The unit tests ran through, the changes were already extensively tested in the branch. I have no further comments.

comment:38 Changed 3 weeks ago by jkarder

r15292: merged r15287 into stable

comment:39 Changed 3 weeks ago by jkarder

  • Resolution set to done
  • Status changed from readytorelease to closed

r15293: deleted branch Async​

Note: See TracTickets for help on using tickets.