It's all about the answers!

Ask a question

TeamOperationCanceledException when trying to deliver multiple changesets at the same time.


Jazzuser user (4829) | asked Aug 04 '17, 4:55 a.m.

Hello All,

We have a usecase wherein we need to deliver multiple changesets to a same workitem.
We are using the following approach :
Use case similar to  : https://rsjazz.wordpress.com/2013/09/30/delivering-change-sets-and-baselines-to-a-stream-using-the-plain-java-client-libraries/
1. file/folder is created as a changeset, so we have multiple changesets created.
2. Adding each changeset to a arraylist.
3. Once all the changesets are created and listed in the arraylist, we are trying to deliver each changeset using FOR Loop :
deliver logic :

IFileSystemWorkItemManager fileSystemWorkItemManager = (IFileSystemWorkItemManager) fTeamRepository.getClientLibrary(IFileSystemWorkItemManager.class);

List<ILink> links = fileSystemWorkItemManager.createLink(streamHandle, changeSet, new IWorkItemHandle[] { (IWorkItemHandle) workitem .getItemHandle() }, null);

IChangeHistorySyncReport sync = fWorkspace.compareTo(streamWsConn, WorkspaceComparisonFlags.CHANGE_SET_COMPARISON_ONLY,Collections.EMPTY_LIST, fMonitor);

fWorkspace.deliver(streamWsConn, sync, Collections.EMPTY_LIST, sync.outgoingChangeSets(compHandle), fMonitor);

We have two ways of delivering this changesets :
1. deliver each changeset when created
2. deliver all the changesets, by storing it in the arraylist, after all the CS are created.

First way is working fine, however we need to deliver all the CS at the end(one by one from the arraylist).... :(

we are getting the exception :
com.ibm.team.process.common.advice.TeamOperationCanceledException: 'Deliver' failed. Preconditions have not been met: A work item or change request must be associated with the change set and a comment must be set.
com.ibm.team.process.common.advice.TeamOperationCanceledException: 'Deliver' failed. Preconditions have not been met: A work item or change request must be associated with the change set and a comment must be set.

we have the CS comment and workitem for the precondition already set, but still the exception.
Also it is a exception on the console, but the changesets are getting delivered to the stream.

when we analysed,
we found TeamOperationCanceledException thrown from compareTo(), tries to compare the active CS and the monitor passed here is nullProgressMonitor,

our assumption :
if we have a single CS, we are not getting any exception. (since IChangeHistorySyncReport, no other acive CS are there to compare and we also have nullProgressMonitor, that cancels the operation)
for multiple CS, due to IChangeHistorySyncReport(we get OperationCanceledException
                  if the operation is canceled. Cancellation can occur even if
    
             no progress monitor is provided.)

What need to changed in the nullProgressMonitor ? so that the TeamOperationCanceledException  is avoided ?

Where are we going wrong :( please advise.



One answer



permanent link
Ralph Schoon (59.0k23642) | answered Aug 04 '17, 6:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

As far as i can tell, the error message comes up, because you try to deliver the change sets and they are not linked to a work item, but you have the operation behavior configured to require a work item.

It is always a good idea to use a test project area and to remove other operational behavior for the tests.
Based on the error message there is no work item associated to the change sets you try to deliver.

PS: If I am not mistaken, creation of a work item to change set link is limited to the SCM API Jazz Component and you will likely see an error message saying so, if you try.


Comments
Jazzuser user commented Aug 04 '17, 7:02 a.m.

Thanks for the reply Ralph. But linking a workitem is not the issue here, we already have a workitem linking it. As i mentioned, if we are delivering each CS when created, it is linking to the workitem and getting delivered.
But when all the CS are delivered to same WI, it is throwing this exception : TeamOperationCanceledException.
Is it something to do with the IChangeHistorySyncReport, compareTo() and NullprogressMonitor ?
we suspect : if there are multiple active CS, IChangeHistorySyncReport is trying some operation and getting cancelled by nullProgMonitor ?

Coz the src doc tells :  * @throws OperationCanceledException
                  if the operation is canceled. Cancellation can occur even if
    
             no progress monitor is provided.




Jazzuser user commented Aug 04 '17, 7:06 a.m.

E.g : in a loop of 5 CSs to be delivered,
first 4 CS gets the Exception on the console and getting delivered to the stream.
last CS, without any exceptions, getting delivered to the stream.

if we have only one CS, no exception.

It is something with the compareTo() and IChangeHistorySyncReport :(


1
Ralph Schoon commented Aug 04 '17, 7:16 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

com.ibm.team.process.common.advice.TeamOperationCanceledException: 'Deliver' failed. Preconditions have not been met: A work item or change request must be associated with the change set and a comment must be set.
com.ibm.team.process.common.advice.TeamOperationCanceledException: 'Deliver' failed. Preconditions have not been met: A work item or change request must be associated with the change set and a comment must be set.


Ralph Schoon commented Aug 04 '17, 7:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Sorry, but that is basically all I can do. I had a hard time with the SCM API as well, but at the moment, I only see that the advisor seems to be upset for a change set not having a work item or a comment (the advisor is set to want BOTH).

I have learned that it is best to limit factors and thus I would again suggest to disable these advisors and make sure the SCM code works before doing the next step.


Jazzuser user commented Aug 07 '17, 4:58 a.m.

Thanks for the reply Ralph.
as you suggested, we disabled the precondition and tried delivering the CS, still the same exception : TeamOperationCanceledException: 'Deliver' failed. Preconditions have not been met: A work item or change request must be associated with the change set and a comment must be set.

Not sure why the exception describes the precondition, even when it is disabled.

Also, as i mentioned earlier, is it something to do with :
IChangeHistorySyncReport, compareTo() and NullprogressMonitor ?
we suspect : if there are multiple active CS, IChangeHistorySyncReport is trying some operation and getting cancelled by nullProgMonitor ?

Please suggest.


Ralph Schoon commented Aug 07 '17, 5:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

One of my customers uses process inheritance - you basically can not disable the preconditions, because they are inherited from the master process.

Just make sure you don't have that kind of situation. As long as I see that message up there, my assumption is you are running into a precondition and I don't think you see a different issue. I might be wrong, of course.

showing 5 of 6 show 1 more comments

Your answer


Register or to post your answer.