It's all about the answers!

Ask a question

API call to get RTC engine build activity

SUNIL KUURAM (6431923) | asked Mar 26 '13, 9:38 a.m.
edited Mar 27 '13, 1:35 p.m. by Spencer Murata (2.3k115971)

I was trying to get the number of builds in progress on RTC engine. The API call IBuildEngineActivityHandle.size() returns 69 for all engines. Please let me know if you saw this problem before. Here's my code snippet.

            teamRepository = TeamPlatform.getTeamRepositoryService()
            teamRepository.registerLoginHandler(new LoginHandler(userId,
            ITeamBuildClient buildClient = (ITeamBuildClient) teamRepository.getClientLibrary(ITeamBuildClient.class);
            IItemManager itemManager = teamRepository.itemManager();

IBuildEngine buildEngine=buildClient.getBuildEngine("RationalBuildforgeConnector", monitor);
       IBuildEngineActivityHandle ib=buildEngine.getBuildEngineActivity();


5 answers

permanent link
Spencer Murata (2.3k115971) | answered Mar 27 '13, 1:37 p.m.
 The build activities are all activities in all builds running on the engine.  So if you want builds running you want to gather the BuildResult and only those whose state is IN_PROGRESS.


permanent link
SUNIL KUURAM (6431923) | answered Mar 27 '13, 3:00 p.m.
Hi Spencer,

Sorry, If I not being clear. I am looking to list active builds on the engine (right click engine - select Show Build Activity) via API call. Could you give some pointers?


permanent link
Nick Edgar (6.5k711) | answered Apr 13 '13, 2:01 p.m.
An IBuildEngineActivity item maintain the last contact time for an engine.  As with any other item, it's referenced by an item handle, in this case an IBuildEngineActivityItemHandle.  IItemHandle defines size(), but that's misleading -- it gives an estimate of the number of bytes taken by the handle's representation.

To get the list of active (i.e. in-progress) builds for a given build engine, you'd need to run an item query.
There's an internal query service method for builds that the Eclipse UI uses.  For example,


where fBuildEngineHandle is an IBuildEngineHandle.
The criteria object is then passed to the query service method in:, IProgressMonitor)
which does:

getRecordClient().getBuildResultRecords(buildQueryCriteria, buildResultProperties, monitor)

where getRecordClient() is:


The criteria object also lets you filter by build state:

Another option is to call:, IProgressMonitor)
where the resulting record lists the in-progress builds:
but this is also internal.

It's also possible to construct your own item query.  Although IBuildResultQueryModel lets you query for builds in a given state, the query model that's exposed as API does not let you filter by handling build engine (which is on the build's IBuildRequest item, not the IBuildResult).  Unfortunately, I don't see any way to do this with our current API.  Please feel free to open an enhancement request for this.

permanent link
Alan Jamison (1) | answered May 16 '14, 6:29 p.m.

   Your suggestion above works very well to get IInProgressBuilds[] on a build engine.  With each IInProgressBuild record I can get the, the label(), and currentBuildActivityLabel().

    How do I get the StartTime and Duration of the build-in-progress (as also shows in Eclipse)?  Which objects do I need to traverse?  Do I somehow use the buildResult and then the fullState iItem?

    Thanks you for any tips.  I have looked very hard, but can not find a definitive answer to this.


sam detweiler commented May 16 '14, 8:24 p.m.

everything is in the build result

long getBuildStartTime()
Get the time the build was started.
long getBuildTimeTaken()
Get the time taken by the build.

permanent link
Alan Jamison (1) | answered May 17 '14, 11:09 p.m.
Excellent, thank you very much. 
I knew I was close, but I needed to correctly fetch the IBuildResult object.  This link helped bridge that gap: Fetch the data from the IBuildResultHandle

    public IBuildResult getBuildResult(IBuildResultHandle iBRH) throws TeamRepositoryException
        IItemManager itemManager = teamRepository.itemManager();
        IBuildResult buildResultData = null;
            buildResultData = (IBuildResult)itemManager.fetchCompleteItem(iBRH, IItemManager.REFRESH, myPM);
        } catch(ItemNotFoundException infx) {
            logger.warn("RtcRepository.getBuildResult(), ItemNotFoundException, "+infx.getMessage());
        return buildResultData;

   And once done, your tip was perfect.  Since I am reading the running RTC build queue, the active jobs go away from the time I query the queue and the time I go to fetch the build data - so I catch the missing Item case.  And because I am looking at the active running builds, I guess I can't expect to have a BuildTimeTaken value.  I get zero for that call, and presumably would until the build completes?

   Thanks very much for your patience and information!


sam detweiler commented May 18 '14, 6:35 a.m.

yes, if you have the handle to an object, you have to load the rest of the data. you can load everything ( .fetchCompleteItem) or only selected fields (.fetchItem)

time spent is not complete til the build ends,.. yes, but you can calculate it.
now- getBuildStartTime() .

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.