[Anthill-pro] Problem with Filter Agent script execution

Uldis Karlovs-Karlovskis uldisk at ctco.lv
Mon Jan 7 02:08:56 CST 2008


Hello!
I have unexpected issue with my Agent Filter script. All the time my scripts
were working fine and then on last Friday anthill started to throw error:

2008-01-07 09:53:15,664 ERROR Workflow-5 ()
com.urbancode.anthill3.services.jobs.JobGraph - Workflow failed processing
job '10.00 Get Site deploy agent' due to unexpected error: Method Invocation
super.filter
2008-01-07 09:53:15,664 ERROR Workflow-5 ()
com.urbancode.anthill3.services.exception.ExceptionService - Method
Invocation super.filter 

There were no reconfiguration in this time, it just stopped working.

This Agent Filter script is executed on Non-originating workflow to get
deployment agent on right server. This is happening for all ways to run a
build, also when I try to run it from "Run Workflow" tab. It is running for
3:15 minutes, no jobs are executed and Status is Error.

In the same time for other projects my script is working fine and I have`nt
changed it for weeks so there is some hunged up process for project. I`ve
tried to restart build agents and server but it did not help. I`m working
with version 3.3.6b219.

This is my script:

import com.urbancode.anthill3.domain.agent.Agent;
import com.urbancode.anthill3.domain.script.agentfilter.criteria.*;
import com.urbancode.anthill3.runtime.scripting.helpers.*;
import org.apache.log4j.Priority;
import com.urbancode.commons.util.logging.Log4jPrintStream;

public class PropertyEqualsAgentVar extends VariableEqualsCriteria {
    String propertyname;
    String nonPropertyname;
    Log4jPrintStream wlogger = new Log4jPrintStream("MyLog", Priority.WARN);
    Log4jPrintStream elogger = new Log4jPrintStream("MyLog",
Priority.ERROR);

    public PropertyEqualsAgentVar(String nonPropertyname, String
propertyname, String agentVarName, Log4jPrintStream wlogger,
Log4jPrintStream elogger) {
        super(agentVarName);
        this.propertyname = propertyname;
        this.nonPropertyname = nonPropertyname;
        this.wlogger = wlogger;
        this.elogger = elogger;
     }

     public Agent[] filter(Agent[] agents){
        String platform = null;
        if(BuildRequestLookup.getCurrent() != null){
            platform =
BuildRequestLookup.getCurrent().getProperty(nonPropertyname);
        }
        if(platform == null || platform.length() == 0 ||
"null".equals(platform)) {
            platform = PropertyLookup.get(nonPropertyname);
        }
        if(platform == null || platform.length() == 0 ||
"null".equals(platform))
        {
            elogger.println("Non-originating Property \"" + nonPropertyname
+ "\" not found!");
            return super.filter(null);
        }
        else
        {
            if(platform.equals("default"))
            {
                wlogger.println("Filtering agents depending on orig WF
property");
                platform =
BuildRequestLookup.getCurrent().getProperty(propertyname);
                 if (platform == null || platform.length() == 0 ||
"null".equals(platform)) {
                     platform = PropertyLookup.get(propertyname);
                 }
                 if (platform == null || platform.length() == 0 ||
"null".equals(platform)) {
                     platform =
BuildLifeLookup.getCurrent().getOriginatingWorkflow().getRequest().getProper
ty(propertyname);
                 }
                if(platform == null || platform.length() == 0 ||
"null".equals(platform))
                {
                    elogger.println(propertyname + " not found.");
                    return super.filter(null);
                }
            }
            else
            {
                wlogger.println("Filtering agents depending on non-orig WF
property");
            }
        }


        this.setValue(platform);
        return super.filter(agents);
        }
    }




        Log4jPrintStream wlogger = new Log4jPrintStream("MyLog",
Priority.WARN);
        Log4jPrintStream elogger = new Log4jPrintStream("MyLog",
Priority.ERROR);
        wlogger.println("Filtering agents...");

        return Where.is(new
PropertyEqualsAgentVar("nonorig/config.name","orig/config.name",
"ws/virtual_host", wlogger,elogger));

Uldis Karlovs-Karlovskis, C. T. Co
uldis.karlovs-karlovskis at ctco.lv



More information about the Anthill-pro mailing list