You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@oodt.apache.org by karanjeets <gi...@git.apache.org> on 2015/11/10 12:18:40 UTC

[GitHub] oodt pull request: OODT-918 - Prerequisite workflow condition to c...

GitHub user karanjeets opened a pull request:

    https://github.com/apache/oodt/pull/35

    OODT-918 - Prerequisite workflow condition to check ordering of Resource Manager jobs

    Created a new workflow condition that enable us to check for prerequisite jobs scheduled in Resource Manager.
    
    **Assumption**
    Job names and Resource Manager Url is provided through configuration file.
    
    **JIRA Ticket**
    OODT-918

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/karanjeets/oodt master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/oodt/pull/35.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #35
    
----
commit abdf7d983b2a2a14cd25f9e854d68536c9f7d2a2
Author: Karanjeet Singh <co...@gmail.com>
Date:   2015-10-17T11:15:46Z

    Merge pull request #1 from apache/master
    
    Updating OODT forked repository

commit 63a88fd47f5a84f330e74d513a803c922b7ff4ab
Author: Karanjeet Singh <co...@gmail.com>
Date:   2015-11-08T13:40:07Z

    Merge pull request #2 from apache/master
    
    Update from the main repository

commit 66784e8c98963cea8be7e0ba944baaa5de95e99d
Author: Karanjeet Singh <co...@gmail.com>
Date:   2015-11-10T11:10:56Z

    OODT-918 - Create a prerequisite workflow condition

commit 0edbddc1c8949d4913e55665c2fe01907c68f8a8
Author: Karanjeet Singh <co...@gmail.com>
Date:   2015-11-10T11:14:03Z

    OODT-918 - Created a prerequisite workflow condition

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] oodt pull request: OODT-918 - Prerequisite workflow condition to c...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/oodt/pull/35


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] oodt pull request: OODT-918 - Prerequisite workflow condition to c...

Posted by karanjeets <gi...@git.apache.org>.
Github user karanjeets commented on the pull request:

    https://github.com/apache/oodt/pull/35#issuecomment-158697073
  
    @chrismattmann Since, we have moved DRAT to OODT-0.10, can ResmgrJobCondition be available in that ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] oodt pull request: OODT-918 - Prerequisite workflow condition to c...

Posted by chrismattmann <gi...@git.apache.org>.
Github user chrismattmann commented on the pull request:

    https://github.com/apache/oodt/pull/35#issuecomment-158733774
  
    @karanjeets we should just release 0.11 and make sure that DRAT is compatible with it. make sense?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] oodt pull request: OODT-918 - Prerequisite workflow condition to c...

Posted by chrismattmann <gi...@git.apache.org>.
Github user chrismattmann commented on a diff in the pull request:

    https://github.com/apache/oodt/pull/35#discussion_r44409273
  
    --- Diff: workflow/src/main/java/org/apache/oodt/cas/workflow/examples/PrerequisiteCondition.java ---
    @@ -0,0 +1,97 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +
    +package org.apache.oodt.cas.workflow.examples;
    +
    +import java.net.MalformedURLException;
    +import java.net.URL;
    +import java.util.Arrays;
    +import java.util.Date;
    +import java.util.Iterator;
    +
    +//OODT imports
    +import org.apache.oodt.cas.metadata.Metadata;
    +import org.apache.oodt.cas.resource.structs.Job;
    +import org.apache.oodt.cas.resource.structs.exceptions.JobQueueException;
    +import org.apache.oodt.cas.resource.system.XmlRpcResourceManagerClient;
    +import org.apache.oodt.cas.workflow.structs.WorkflowConditionConfiguration;
    +import org.apache.oodt.cas.workflow.structs.WorkflowConditionInstance;
    +
    +/**
    + * @author singhk
    + * @version $Revision$
    + *
    + * <p>A Simple condition that evaluates to false as many times as the prerequisite job in Resource Manager
    + * isn't completed. After that, the condition returns
    + * true.</p>
    + *
    + */
    +public class PrerequisiteCondition implements WorkflowConditionInstance {
    +
    +	public PrerequisiteCondition() {
    +		super();
    +	}
    +	
    +	/**
    +	 * Check if there is any job queued in Resource Manager with name equivalent to <code>jobName</code>
    +	 * @param client
    +	 * @param jobName
    +	 * @return true if job is present, otherwise false
    +	 */
    +	@SuppressWarnings("unchecked")
    +	private boolean isJobPresentInQueue(XmlRpcResourceManagerClient client, String jobName){
    +		Iterator<Job> iter;
    +		try {
    +			iter = (Iterator<Job>)client.getQueuedJobs().iterator();
    +			while(iter.hasNext()){
    +				Job job = iter.next();
    +				if(job.getName().equals(jobName))
    +					return true;
    +			}
    +		} catch (JobQueueException e) {
    +			e.printStackTrace();
    +		}
    +		return false;
    +	}
    +
    +	/* (non-Javadoc)
    +	 * @see org.apache.oodt.cas.workflow.structs.WorkflowConditionInstance#evaluate(org.apache.oodt.cas.metadata.Metadata)
    +	 */
    +    public boolean evaluate(Metadata metadata, WorkflowConditionConfiguration config) {
    +		
    +		String[] jobs = (config.getProperty("JOBS")).split(",");
    +		String resourceManagerUrl = config.getProperty("RESMGR_URL");
    +		boolean flag = true;
    +
    +		System.out.println(new Date() + " PrerequisiteCondition: Jobs: "+ Arrays.toString(jobs));
    +		System.out.println(new Date() + " PrerequisiteCondition: Resource Manager: "+ resourceManagerUrl);
    --- End diff --
    
    LOG.info()


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] oodt pull request: OODT-918 - Prerequisite workflow condition to c...

Posted by chrismattmann <gi...@git.apache.org>.
Github user chrismattmann commented on a diff in the pull request:

    https://github.com/apache/oodt/pull/35#discussion_r44409317
  
    --- Diff: workflow/src/main/java/org/apache/oodt/cas/workflow/examples/PrerequisiteCondition.java ---
    @@ -0,0 +1,97 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +
    +package org.apache.oodt.cas.workflow.examples;
    +
    +import java.net.MalformedURLException;
    +import java.net.URL;
    +import java.util.Arrays;
    +import java.util.Date;
    +import java.util.Iterator;
    +
    +//OODT imports
    +import org.apache.oodt.cas.metadata.Metadata;
    +import org.apache.oodt.cas.resource.structs.Job;
    +import org.apache.oodt.cas.resource.structs.exceptions.JobQueueException;
    +import org.apache.oodt.cas.resource.system.XmlRpcResourceManagerClient;
    +import org.apache.oodt.cas.workflow.structs.WorkflowConditionConfiguration;
    +import org.apache.oodt.cas.workflow.structs.WorkflowConditionInstance;
    +
    +/**
    + * @author singhk
    + * @version $Revision$
    + *
    + * <p>A Simple condition that evaluates to false as many times as the prerequisite job in Resource Manager
    + * isn't completed. After that, the condition returns
    + * true.</p>
    + *
    + */
    +public class PrerequisiteCondition implements WorkflowConditionInstance {
    --- End diff --
    
    maybe rename the class to ResmgrJobCondition?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] oodt pull request: OODT-918 - Prerequisite workflow condition to c...

Posted by buggtb <gi...@git.apache.org>.
Github user buggtb commented on the pull request:

    https://github.com/apache/oodt/pull/35#issuecomment-159948612
  
    Guys (Chris) I don't think you should ship 0.11 with OODT-781 still open, I'll see if I can find some time over the next few days to look at it, but not being able to delete products is pretty bad I would say!
    
    Tom


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] oodt pull request: OODT-918 - Prerequisite workflow condition to c...

Posted by chrismattmann <gi...@git.apache.org>.
Github user chrismattmann commented on the pull request:

    https://github.com/apache/oodt/pull/35#issuecomment-159952830
  
    got it @buggtb agreed. Let's try and get [OODT-781](http://issues.apache.org/jira/browse/OODT-781) handled as part of 0.11.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] oodt pull request: OODT-918 - Prerequisite workflow condition to c...

Posted by karanjeets <gi...@git.apache.org>.
Github user karanjeets commented on the pull request:

    https://github.com/apache/oodt/pull/35#issuecomment-155604339
  
    @chrismattmann  Done. :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] oodt pull request: OODT-918 - Prerequisite workflow condition to c...

Posted by chrismattmann <gi...@git.apache.org>.
Github user chrismattmann commented on a diff in the pull request:

    https://github.com/apache/oodt/pull/35#discussion_r44409260
  
    --- Diff: workflow/src/main/java/org/apache/oodt/cas/workflow/examples/PrerequisiteCondition.java ---
    @@ -0,0 +1,97 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +
    +package org.apache.oodt.cas.workflow.examples;
    +
    +import java.net.MalformedURLException;
    +import java.net.URL;
    +import java.util.Arrays;
    +import java.util.Date;
    +import java.util.Iterator;
    +
    +//OODT imports
    +import org.apache.oodt.cas.metadata.Metadata;
    +import org.apache.oodt.cas.resource.structs.Job;
    +import org.apache.oodt.cas.resource.structs.exceptions.JobQueueException;
    +import org.apache.oodt.cas.resource.system.XmlRpcResourceManagerClient;
    +import org.apache.oodt.cas.workflow.structs.WorkflowConditionConfiguration;
    +import org.apache.oodt.cas.workflow.structs.WorkflowConditionInstance;
    +
    +/**
    + * @author singhk
    + * @version $Revision$
    + *
    + * <p>A Simple condition that evaluates to false as many times as the prerequisite job in Resource Manager
    + * isn't completed. After that, the condition returns
    + * true.</p>
    + *
    + */
    +public class PrerequisiteCondition implements WorkflowConditionInstance {
    +
    +	public PrerequisiteCondition() {
    +		super();
    +	}
    +	
    +	/**
    +	 * Check if there is any job queued in Resource Manager with name equivalent to <code>jobName</code>
    +	 * @param client
    +	 * @param jobName
    +	 * @return true if job is present, otherwise false
    +	 */
    +	@SuppressWarnings("unchecked")
    +	private boolean isJobPresentInQueue(XmlRpcResourceManagerClient client, String jobName){
    +		Iterator<Job> iter;
    +		try {
    +			iter = (Iterator<Job>)client.getQueuedJobs().iterator();
    +			while(iter.hasNext()){
    +				Job job = iter.next();
    +				if(job.getName().equals(jobName))
    +					return true;
    +			}
    +		} catch (JobQueueException e) {
    +			e.printStackTrace();
    +		}
    +		return false;
    +	}
    +
    +	/* (non-Javadoc)
    +	 * @see org.apache.oodt.cas.workflow.structs.WorkflowConditionInstance#evaluate(org.apache.oodt.cas.metadata.Metadata)
    +	 */
    +    public boolean evaluate(Metadata metadata, WorkflowConditionConfiguration config) {
    +		
    +		String[] jobs = (config.getProperty("JOBS")).split(",");
    +		String resourceManagerUrl = config.getProperty("RESMGR_URL");
    +		boolean flag = true;
    +
    +		System.out.println(new Date() + " PrerequisiteCondition: Jobs: "+ Arrays.toString(jobs));
    --- End diff --
    
    Change to LOG.info


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] oodt pull request: OODT-918 - Prerequisite workflow condition to c...

Posted by karanjeets <gi...@git.apache.org>.
Github user karanjeets commented on the pull request:

    https://github.com/apache/oodt/pull/35#issuecomment-158901973
  
    okay. got it :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---