continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r999760 - in /continuum/trunk: continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ continuum-buildagent/c...
Date Wed, 22 Sep 2010 05:24:33 GMT
Author: ctan
Date: Wed Sep 22 05:24:33 2010
New Revision: 999760

URL: http://svn.apache.org/viewvc?rev=999760&view=rev
Log:
[CONTINUUM-2572] added new methods for easier checking if project group is currently preparing
build or in prepare build queue. also added some logs to help us determine the problem when
build failed.

Modified:
    continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/PrepareBuildProjectsTaskExecutor.java
    continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/stubs/SlaveBuildAgentTransportClientStub.java
    continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
    continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
    continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java?rev=999760&r1=999759&r2=999760&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
Wed Sep 22 05:24:33 2010
@@ -108,6 +108,10 @@ public interface ContinuumBuildAgentServ
 
     boolean isProjectInBuildQueue( int projectId );
 
+    boolean isProjectGroupInPrepareBuildQueue( int projectGroupId );
+
+    boolean isProjectGroupCurrentlyPreparingBuild( int projectGroupId );
+
     boolean removeFromPrepareBuildQueue( int projectGroupId, int scmRootId )
         throws ContinuumBuildAgentException;
 

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java?rev=999760&r1=999759&r2=999760&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
Wed Sep 22 05:24:33 2010
@@ -776,21 +776,22 @@ public class ContinuumBuildAgentServiceI
     {
         try
         {
-            PrepareBuildProjectsTask currentPrepareBuildTask = buildAgentTaskQueueManager.getCurrentProjectInPrepareBuild();
-
-            if ( currentPrepareBuildTask != null && currentPrepareBuildTask.getProjectGroupId()
== projectGroupId )
+            for ( PrepareBuildProjectsTask task : buildAgentTaskQueueManager.getProjectsInPrepareBuildQueue()
)
             {
-                return true;
+                if ( task.getProjectGroupId() == projectGroupId )
+                {
+                    return true;
+                }
             }
 
-            BuildProjectTask currentBuildTask = buildAgentTaskQueueManager.getCurrentProjectInBuilding();
+            PrepareBuildProjectsTask currentPrepareBuildTask = buildAgentTaskQueueManager.getCurrentProjectInPrepareBuild();
 
-            if ( currentBuildTask != null && currentBuildTask.getProjectGroupId()
== projectGroupId )
+            if ( currentPrepareBuildTask != null && currentPrepareBuildTask.getProjectGroupId()
== projectGroupId )
             {
                 return true;
             }
 
-            for ( PrepareBuildProjectsTask task : buildAgentTaskQueueManager.getProjectsInPrepareBuildQueue()
)
+            for ( BuildProjectTask task : buildAgentTaskQueueManager.getProjectsInBuildQueue()
)
             {
                 if ( task.getProjectGroupId() == projectGroupId )
                 {
@@ -798,13 +799,12 @@ public class ContinuumBuildAgentServiceI
                 }
             }
 
-            for ( BuildProjectTask task : buildAgentTaskQueueManager.getProjectsInBuildQueue()
)
+            BuildProjectTask currentBuildTask = buildAgentTaskQueueManager.getCurrentProjectInBuilding();
+
+            if ( currentBuildTask != null && currentBuildTask.getProjectGroupId()
== projectGroupId )
             {
-                if ( task.getProjectGroupId() == projectGroupId )
-                {
-                    return true;
-                }
-            }
+                return true;
+            }            
         }
         catch ( TaskQueueManagerException e )
         {
@@ -869,6 +869,45 @@ public class ContinuumBuildAgentServiceI
         return false;
     }
 
+    public boolean isProjectGroupInPrepareBuildQueue( int projectGroupId )
+    {
+        try
+        {
+            for ( PrepareBuildProjectsTask task : buildAgentTaskQueueManager.getProjectsInPrepareBuildQueue()
)
+            {
+                if ( task.getProjectGroupId() == projectGroupId )
+                {
+                    return true;
+                }
+            }
+        }
+        catch ( TaskQueueManagerException e )
+        {
+            log.error( "Error while checking if project group " + projectGroupId + " is in
prepare build queue in agent", e);
+        }
+
+        return false;
+    }
+
+    public boolean isProjectGroupCurrentlyPreparingBuild( int projectGroupId )
+    {
+        try
+        {
+            PrepareBuildProjectsTask currentPrepareBuildTask = buildAgentTaskQueueManager.getCurrentProjectInPrepareBuild();
+
+            if ( currentPrepareBuildTask != null && currentPrepareBuildTask.getProjectGroupId()
== projectGroupId )
+            {
+                return true;
+            }
+        }
+        catch ( TaskQueueManagerException e )
+        {
+            log.error( "Error while checking if project group " + projectGroupId + " is currently
preparing build in agent", e);
+        }
+
+        return false;
+    }
+
     public boolean isProjectCurrentlyBuilding( int projectId )
     {
         try

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java?rev=999760&r1=999759&r2=999760&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
Wed Sep 22 05:24:33 2010
@@ -104,46 +104,53 @@ public class BuildProjectTaskExecutor
 
         int projectId = buildProjectTask.getProjectId();
 
-        log.info( "Initializing build (projectId=" + projectId + ")" );
-        BuildContext context = buildContextManager.getBuildContext( projectId );
-        initializeBuildContext( context );
-
-        if ( !checkScmResult( context ) )
-        {
-            log.info( "Error updating from SCM, not building" );
-            return;
-        }
-
-        log.info( "Checking if project '" + context.getProjectName() + "' should build" );
-        if ( !shouldBuild( context ) )
-        {
-            return;
-        }
-
-        log.info( "Starting build of " + context.getProjectName() );
-        startBuild( context );
-
         try
         {
+            log.info( "Initializing build (projectId=" + projectId + ")" );
+            BuildContext context = buildContextManager.getBuildContext( projectId );
+            initializeBuildContext( context );
+    
+            if ( !checkScmResult( context ) )
+            {
+                log.info( "Error updating from SCM, not building" );
+                return;
+            }
+    
+            log.info( "Checking if project '" + context.getProjectName() + "' should build"
);
+            if ( !shouldBuild( context ) )
+            {
+                return;
+            }
+    
+            log.info( "Starting build of " + context.getProjectName() );
+            startBuild( context );
+    
             try
             {
-                performAction( "update-project-from-agent-working-directory", context );
+                try
+                {
+                    performAction( "update-project-from-agent-working-directory", context
);
+                }
+                catch ( TaskExecutionException e )
+                {
+                    updateBuildResult( context, ContinuumBuildAgentUtil.throwableToString(
e ) );
+    
+                    //just log the error but don't stop the build from progressing in order
not to suppress any build result messages there
+                    log.error( "Error executing action update-project-from-agent-working-directory
'", e );
+                }
+    
+                performAction( "execute-agent-builder", context );
+    
+                updateBuildResult( context, null );
             }
-            catch ( TaskExecutionException e )
+            finally
             {
-                updateBuildResult( context, ContinuumBuildAgentUtil.throwableToString( e
) );
-
-                //just log the error but don't stop the build from progressing in order not
to suppress any build result messages there
-                log.error( "Error executing action update-project-from-agent-working-directory
'", e );
+                endBuild( context );
             }
-
-            performAction( "execute-agent-builder", context );
-
-            updateBuildResult( context, null );
         }
-        finally
+        catch ( TaskExecutionException e )
         {
-            endBuild( context );
+            log.error( "Error while trying to build the project {}: {}", projectId, e.getMessage()
);
         }
     }
 

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/PrepareBuildProjectsTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/PrepareBuildProjectsTaskExecutor.java?rev=999760&r1=999759&r2=999760&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/PrepareBuildProjectsTaskExecutor.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/PrepareBuildProjectsTaskExecutor.java
Wed Sep 22 05:24:33 2010
@@ -78,64 +78,71 @@ public class PrepareBuildProjectsTaskExe
 
         Map<String, Object> context = null;
 
-        if ( buildContexts != null && buildContexts.size() > 0 )
+        try
         {
-            try
+            if ( buildContexts != null && buildContexts.size() > 0 )
             {
-                for ( BuildContext buildContext : buildContexts )
+                try
                 {
-                    BuildDefinition buildDef = BuildContextToBuildDefinition.getBuildDefinition(
buildContext );
-
-                    log.info( "Check scm root state" );
-                    if ( !checkProjectScmRoot( context ) )
-                    {
-                        break;
-                    }
-
-                    log.info( "Starting prepare build" );
-                    startPrepareBuild( buildContext );
-
-                    log.info( "Initializing prepare build" );
-                    initializeActionContext( buildContext );
-
-                    try
+                    for ( BuildContext buildContext : buildContexts )
                     {
-                        if ( buildDef.isBuildFresh() )
+                        BuildDefinition buildDef = BuildContextToBuildDefinition.getBuildDefinition(
buildContext );
+    
+                        log.info( "Check scm root state" );
+                        if ( !checkProjectScmRoot( context ) )
                         {
-                            log.info( "Clean up working directory" );
-                            cleanWorkingDirectory( buildContext );
+                            break;
                         }
-
-                        log.info( "Updating working directory" );
-                        updateWorkingDirectory( buildContext );
-
-                        log.info( "Merging SCM results" );
-                        //CONTINUUM-1393
-                        if ( !buildDef.isBuildFresh() )
+    
+                        log.info( "Starting prepare build" );
+                        startPrepareBuild( buildContext );
+    
+                        log.info( "Initializing prepare build" );
+                        initializeActionContext( buildContext );
+    
+                        try
                         {
-                            mergeScmResults( buildContext );
+                            if ( buildDef.isBuildFresh() )
+                            {
+                                log.info( "Clean up working directory" );
+                                cleanWorkingDirectory( buildContext );
+                            }
+    
+                            log.info( "Updating working directory" );
+                            updateWorkingDirectory( buildContext );
+    
+                            log.info( "Merging SCM results" );
+                            //CONTINUUM-1393
+                            if ( !buildDef.isBuildFresh() )
+                            {
+                                mergeScmResults( buildContext );
+                            }
+                        }
+                        finally
+                        {
+                            endProjectPrepareBuild( buildContext );
+                            context = buildContext.getActionContext();
                         }
-                    }
-                    finally
-                    {
-                        endProjectPrepareBuild( buildContext );
-                        context = buildContext.getActionContext();
                     }
                 }
+                finally
+                {
+                    endPrepareBuild( context );
+                }
+    
+                if ( checkProjectScmRoot( context ) )
+                {
+                    buildProjects( buildContexts );
+                }
             }
-            finally
-            {
-                endPrepareBuild( context );
-            }
-
-            if ( checkProjectScmRoot( context ) )
+            else
             {
-                buildProjects( buildContexts );
+                throw new TaskExecutionException( "No project build context" );
             }
         }
-        else
+        catch ( TaskExecutionException e )
         {
-            throw new TaskExecutionException( "No project build context" );
+            log.error( "Error while preparing build of project: {}", e.getMessage() );
         }
     }
 

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/stubs/SlaveBuildAgentTransportClientStub.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/stubs/SlaveBuildAgentTransportClientStub.java?rev=999760&r1=999759&r2=999760&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/stubs/SlaveBuildAgentTransportClientStub.java
(original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/stubs/SlaveBuildAgentTransportClientStub.java
Wed Sep 22 05:24:33 2010
@@ -260,4 +260,18 @@ public class SlaveBuildAgentTransportCli
         return null;
     }
 
+    public Boolean isProjectGroupInPrepareBuildQueue( int projectGroupId )
+        throws Exception
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Boolean isProjectGroupCurrentlyPreparingBuild( int projectGroupId )
+        throws Exception
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java?rev=999760&r1=999759&r2=999760&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
Wed Sep 22 05:24:33 2010
@@ -122,6 +122,12 @@ public interface SlaveBuildAgentTranspor
     public Boolean isProjectInBuildQueue( int projectId )
         throws Exception;
 
+    public Boolean isProjectGroupInPrepareBuildQueue( int projectGroupId )
+        throws Exception;
+
+    public Boolean isProjectGroupCurrentlyPreparingBuild( int projectGroupId )
+        throws Exception;
+
     public Boolean removeFromPrepareBuildQueue( int projectGroupId, int scmRootId )
         throws Exception;
 

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java?rev=999760&r1=999759&r2=999760&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
Wed Sep 22 05:24:33 2010
@@ -628,6 +628,44 @@ public class SlaveBuildAgentTransportCli
         return result;
     }
 
+    public Boolean isProjectGroupInPrepareBuildQueue( int projectGroupId )
+        throws Exception
+    {
+        Boolean result;
+
+        try
+        {
+            result = slave.isProjectGroupInPrepareBuildQueue( projectGroupId );
+            log.info( "Checking if projectGroup " + projectGroupId + "is in prepare build
queue of agent" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to check if projectGroup " + projectGroupId + " is in prepare
build queue of agent", e );
+            throw new Exception( "Failed to check if projectGroup " + projectGroupId + "
is in prepare build queue of agent", e );
+        }
+
+        return result;
+    }
+
+    public Boolean isProjectGroupCurrentlyPreparingBuild( int projectGroupId )
+        throws Exception
+    {
+        Boolean result;
+
+        try
+        {
+            result = slave.isProjectGroupCurrentlyPreparingBuild( projectGroupId );
+            log.info( "Checking if projectGroup " + projectGroupId + "is currently preparing
build" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to check if projectGroup " + projectGroupId + " is currently
preparing build", e );
+            throw new Exception( "Failed to check if projectGroup " + projectGroupId + "
is currently preparing build", e );
+        }
+
+        return result;
+    }
+
     public Boolean removeFromPrepareBuildQueue( int projectGroupId, int scmRootId )
         throws Exception
     {

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java?rev=999760&r1=999759&r2=999760&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java
Wed Sep 22 05:24:33 2010
@@ -470,6 +470,20 @@ public class SlaveBuildAgentTransportSer
         return continuumBuildAgentService.isProjectInBuildQueue( projectId );
     }
 
+    public Boolean isProjectGroupInPrepareBuildQueue( int projectGroupId )
+        throws Exception
+    {
+        log.info( "Checking if project group '" + projectGroupId + "' is in prepare build
queue" );
+        return continuumBuildAgentService.isProjectGroupInPrepareBuildQueue( projectGroupId
);
+    }
+
+    public Boolean isProjectGroupCurrentlyPreparingBuild( int projectGroupId )
+        throws Exception
+    {
+        log.info( "Checking if project group '" + projectGroupId + "' is currently preparing
build" );
+        return continuumBuildAgentService.isProjectGroupCurrentlyPreparingBuild( projectGroupId
);
+    }
+
     public Boolean removeFromPrepareBuildQueue( int projectGroupId, int scmRootId )
         throws Exception
     {



Mime
View raw message