You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2013/01/02 20:49:56 UTC
svn commit: r1427978 [3/7] - in
/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src: main/ main/java/
main/java/org/ main/java/org/apache/ main/java/org/apache/uima/
main/java/org/apache/uima/ducc/ main/java/org/apache/uima/ducc/transport/
main/java/...
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitReservationDuccEvent.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitReservationDuccEvent.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitReservationDuccEvent.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitReservationDuccEvent.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,27 @@
+/*
+ * 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.uima.ducc.transport.event;
+
+@SuppressWarnings("serial")
+public class SubmitReservationDuccEvent extends AbstractDuccReservationEvent {
+
+ public SubmitReservationDuccEvent() {
+ super(EventType.SUBMIT_RESERVATION);
+ }
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitReservationDuccEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitReservationReplyDuccEvent.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitReservationReplyDuccEvent.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitReservationReplyDuccEvent.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitReservationReplyDuccEvent.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,27 @@
+/*
+ * 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.uima.ducc.transport.event;
+
+@SuppressWarnings("serial")
+public class SubmitReservationReplyDuccEvent extends AbstractDuccReservationEvent {
+
+ public SubmitReservationReplyDuccEvent() {
+ super(EventType.RESERVATION_REPLY);
+ }
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitReservationReplyDuccEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitServiceDuccEvent.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitServiceDuccEvent.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitServiceDuccEvent.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitServiceDuccEvent.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,27 @@
+/*
+ * 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.uima.ducc.transport.event;
+
+@SuppressWarnings("serial")
+public class SubmitServiceDuccEvent extends AbstractDuccJobEvent {
+
+ public SubmitServiceDuccEvent() {
+ super(EventType.SUBMIT_SERVICE);
+ }
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitServiceDuccEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitServiceReplyDuccEvent.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitServiceReplyDuccEvent.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitServiceReplyDuccEvent.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitServiceReplyDuccEvent.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,27 @@
+/*
+ * 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.uima.ducc.transport.event;
+
+@SuppressWarnings("serial")
+public class SubmitServiceReplyDuccEvent extends AbstractDuccJobEvent {
+
+ public SubmitServiceReplyDuccEvent() {
+ super(EventType.SERVICE_REPLY);
+ }
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/SubmitServiceReplyDuccEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobReplyProperties.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobReplyProperties.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobReplyProperties.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobReplyProperties.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,35 @@
+/*
+ * 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.uima.ducc.transport.event.cli;
+
+import java.io.Serializable;
+
+/**
+ * Reply characteristics provided by JM.
+ */
+
+@SuppressWarnings("serial")
+public class JobReplyProperties extends JobRequestProperties implements Serializable {
+
+ public static String key_message = "message";
+
+ public static String msg_user_not_authorized = "user not authorized";
+ public static String msg_not_found = "not found";
+ public static String msg_canceled = "canceled";
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobReplyProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobRequestProperties.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobRequestProperties.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobRequestProperties.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobRequestProperties.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,91 @@
+/*
+ * 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.uima.ducc.transport.event.cli;
+
+import java.io.Serializable;
+import java.util.Enumeration;
+
+import org.apache.uima.ducc.common.utils.DuccLogger;
+
+
+/**
+ * Request characteristics provided by user.
+ */
+@SuppressWarnings("serial")
+public class JobRequestProperties extends JobSpecificationProperties implements Serializable {
+
+ /*
+ * request type: one per request, else error
+ */
+ public static String key_request_type_submit = "request_type_submit";
+ public static String key_request_type_cancel = "request_type_cancel";
+ public static String key_request_type_modify = "request_type_modify";
+
+ /*
+ * The broker and endpoint servicing submit, modify and cancel
+ */
+ public static String key_service_broker = "service_broker";
+ public static String key_service_endpoint = "service_endpoint";
+
+ /*
+ * The broker and endpoint servicing the user specified (at submission)
+ * job CR and corresponding UIMA-AS services
+ */
+ public static String key_job_broker = "job_broker";
+ public static String key_job_endpoint = "job_endpoint";
+
+ /*
+ * id: required for cancel/modify requests; error for submit request
+ */
+ public static String key_id = "id";
+
+ public void specification(DuccLogger logger) {
+ String methodName = "specification";
+ Enumeration<Object> keys = keys();
+ while(keys.hasMoreElements()) {
+ String key = (String) keys.nextElement();
+ String value = getProperty(key);
+ logger.info(methodName, null, key+":"+value);
+ }
+ }
+
+ public void normalize() {
+ Enumeration<Object> keys = keys();
+ while(keys.hasMoreElements()) {
+ String key = (String) keys.nextElement();
+ if(key != null) {
+ String tkey = key.trim();
+ if(!tkey.equals(key)) {
+ String value = getProperty(key);
+ remove(key);
+ put(tkey,value);
+ }
+ }
+ }
+ }
+
+ public void dump() {
+ Enumeration<Object> keys = keys();
+ while(keys.hasMoreElements()) {
+ String key = (String) keys.nextElement();
+ String value = getProperty(key);
+ System.out.println(key+":"+value);
+ }
+ }
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobRequestProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobSpecificationProperties.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobSpecificationProperties.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobSpecificationProperties.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobSpecificationProperties.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,132 @@
+/*
+ * 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.uima.ducc.transport.event.cli;
+
+import java.io.Serializable;
+
+/**
+ * Job characteristics provided by user.
+ */
+@SuppressWarnings("serial")
+public class JobSpecificationProperties extends SpecificationProperties implements Serializable {
+
+ public static String key_user = "user";
+ public static String key_specification = "specification";
+
+ public static String key_notifications = "notifications";
+ public static String key_log_directory = "log_directory";
+ public static String key_working_directory = "working_directory";
+
+ public static String key_scheduling_priority = "scheduling_priority";
+
+ public static String key_jvm = "jvm";
+
+ public static String key_driver_jvm_args = "driver_jvm_args";
+ public static String key_driver_classpath = "driver_classpath";
+ public static String key_driver_environment = "driver_environment";
+ public static String key_driver_memory_size = "driver_memory_size";
+ public static String key_driver_descriptor_CR = "driver_descriptor_CR";
+ public static String key_driver_descriptor_CR_overrides = "driver_descriptor_CR_overrides";
+ public static String key_driver_exception_handler = "driver_exception_handler";
+
+ public static String key_process_jvm_args = "process_jvm_args";
+ public static String key_process_classpath = "process_classpath";
+ public static String key_process_environment = "process_environment";
+ public static String key_process_memory_size = "process_memory_size";
+ public static String key_process_DD = "process_DD";
+ public static String key_process_descriptor_CM = "process_descriptor_CM";
+ public static String key_process_descriptor_CM_overrides = "process_descriptor_CM_overrides";
+ public static String key_process_descriptor_AE = "process_descriptor_AE";
+ public static String key_process_descriptor_AE_overrides = "process_descriptor_AE_overrides";
+ public static String key_process_descriptor_CC = "process_descriptor_CC";
+ public static String key_process_descriptor_CC_overrides = "process_descriptor_CC_overrides";
+
+ public static String key_process_deployments_max = "process_deployments_max";
+ public static String key_process_deployments_min = "process_deployments_min";
+ public static String key_process_initialization_failures_cap = "process_initialization_failures_cap";
+ public static String key_process_failures_limit = "process_failures_limit";
+ public static String key_process_thread_count = "process_thread_count";
+
+ public static String key_process_get_meta_time_max = "process_get_meta_time_max";
+ public static String key_process_per_item_time_max = "process_per_item_time_max";
+
+ public static String key_service_dependency = "service_dependency";
+
+ public static String key_wait_for_completion = "wait_for_completion";
+
+ public static String key_classpath_order = "classpath_order";
+
+ public static String[] keys = {
+ JobRequestProperties.key_signature,
+ JobRequestProperties.key_job_broker,
+ JobRequestProperties.key_job_endpoint,
+ JobRequestProperties.key_service_broker,
+ JobRequestProperties.key_service_endpoint,
+ JobRequestProperties.key_description,
+ JobRequestProperties.key_scheduling_class,
+ JobRequestProperties.key_submitter_pid_at_host,
+ key_user,
+ key_specification,
+ key_notifications,
+ key_log_directory,
+ key_working_directory,
+ key_scheduling_priority,
+ key_jvm,
+ key_driver_jvm_args,
+ key_driver_classpath,
+ key_driver_environment,
+ key_driver_memory_size,
+ key_driver_descriptor_CR,
+ key_driver_descriptor_CR_overrides,
+ key_driver_exception_handler,
+ key_process_jvm_args,
+ key_process_classpath,
+ key_process_environment,
+ key_process_memory_size,
+ key_process_DD,
+ key_process_descriptor_CM,
+ key_process_descriptor_CM_overrides,
+ key_process_descriptor_AE,
+ key_process_descriptor_AE_overrides,
+ key_process_descriptor_CC,
+ key_process_descriptor_CC_overrides,
+ key_process_deployments_max,
+ key_process_deployments_min,
+ key_process_initialization_failures_cap,
+ key_process_failures_limit,
+ key_process_thread_count,
+ key_process_get_meta_time_max,
+ key_process_per_item_time_max,
+ key_service_dependency,
+ key_wait_for_completion,
+ key_classpath_order,
+ };
+
+ public boolean isRecognized(String key) {
+ boolean retVal = false;
+ for (String known : keys) {
+ if(known != null) {
+ if (known.equals(key)) {
+ retVal = true;
+ }
+ }
+ }
+ return retVal;
+ }
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobSpecificationProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationReplyProperties.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationReplyProperties.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationReplyProperties.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationReplyProperties.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,34 @@
+/*
+ * 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.uima.ducc.transport.event.cli;
+
+import java.io.Serializable;
+
+/**
+ * Reply characteristics provided by Orchestrator.
+ */
+@SuppressWarnings("serial")
+public class ReservationReplyProperties extends ReservationRequestProperties implements Serializable {
+
+ public static String key_message = "message";
+
+ public static String msg_user_not_authorized = "user not authorized";
+ public static String msg_not_found = "not found";
+ public static String msg_canceled = "canceled";
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationReplyProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationRequestProperties.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationRequestProperties.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationRequestProperties.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationRequestProperties.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,58 @@
+/*
+ * 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.uima.ducc.transport.event.cli;
+
+import java.io.Serializable;
+
+/**
+ * Request characteristics provided by user.
+ */
+@SuppressWarnings("serial")
+public class ReservationRequestProperties extends ReservationSpecificationProperties implements Serializable {
+
+ /*
+ * request type: one per request, else error
+ */
+ public static String key_request_type_submit = "request_type_submit";
+ public static String key_request_type_cancel = "request_type_cancel";
+ public static String key_request_type_modify = "request_type_modify";
+
+ /*
+ * The broker and endpoint servicing submit, modify and cancel
+ */
+ public static String key_service_broker = "service_broker";
+ public static String key_service_endpoint = "service_endpoint";
+
+ /*
+ * The broker and endpoint servicing the user specified (at submission)
+ * job CR and corresponding UIMA-AS services
+ */
+ public static String key_job_broker = "job_broker";
+ public static String key_job_endpoint = "job_endpoint";
+
+ /*
+ * id: required for cancel/modify requests; error for submit request
+ */
+ public static String key_id = "id";
+
+ /*
+ * node_list: list of assigned nodes
+ */
+ public static String key_node_list = "node_list";
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationRequestProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationSpecificationProperties.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationSpecificationProperties.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationSpecificationProperties.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationSpecificationProperties.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,31 @@
+/*
+ * 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.uima.ducc.transport.event.cli;
+
+import java.io.Serializable;
+
+/**
+ * Reservation characteristics provided by user.
+ */
+@SuppressWarnings("serial")
+public class ReservationSpecificationProperties extends SpecificationProperties implements Serializable {
+
+ public static String key_number_of_instances = "number_of_instances";
+ public static String key_instance_memory_size = "instance_memory_size";
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ReservationSpecificationProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ServiceRequestProperties.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ServiceRequestProperties.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ServiceRequestProperties.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ServiceRequestProperties.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,27 @@
+/*
+ * 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.uima.ducc.transport.event.cli;
+
+@SuppressWarnings("serial")
+public class ServiceRequestProperties extends JobRequestProperties {
+ /*
+ * The service endpoint, extracted from the DD by service submit.
+ */
+ public static String key_service_request_endpoint = "service_request_endpoint";
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ServiceRequestProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ServiceSpecificationProperties.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ServiceSpecificationProperties.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ServiceSpecificationProperties.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ServiceSpecificationProperties.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,23 @@
+/*
+ * 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.uima.ducc.transport.event.cli;
+
+@SuppressWarnings("serial")
+public class ServiceSpecificationProperties extends JobSpecificationProperties {
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/ServiceSpecificationProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/SpecificationProperties.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/SpecificationProperties.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/SpecificationProperties.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/SpecificationProperties.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,45 @@
+/*
+ * 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.uima.ducc.transport.event.cli;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+/**
+ * Job characteristics provided by user.
+ */
+@SuppressWarnings("serial")
+public class SpecificationProperties extends Properties implements Serializable {
+
+ public static String key_submit_errors = "submit_errors";
+ public static String key_submit_warnings = "submit_warnings";
+
+ public static String key_user = "user";
+ public static String key_date = "date";
+
+ public static String key_description = "description";
+
+ public static String key_scheduling_class = "scheduling_class";
+
+ public static String key_specification = "specification";
+
+ public static String key_signature = "signature";
+
+ public static String key_submitter_pid_at_host = "submitter_pid_at_host";
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/SpecificationProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/ADuccWork.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/ADuccWork.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/ADuccWork.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/ADuccWork.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,180 @@
+/*
+ * 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.uima.ducc.transport.event.common;
+
+import org.apache.uima.ducc.common.utils.id.DuccId;
+import org.apache.uima.ducc.transport.event.common.IDuccTypes.DuccType;
+
+/*
+ * Work data
+ */
+public abstract class ADuccWork implements IDuccWork {
+
+ /**
+ * please increment this sUID when removing or modifying a field
+ */
+ private static final long serialVersionUID = 1L;
+ private DuccId duccId = null;
+ private DuccType duccType = DuccType.Undefined;
+ private IDuccStandardInfo duccStandardInfo = null;
+ private IDuccSchedulingInfo duccSchedulingInfo = null;
+ private Object stateObject = null;
+ private Object completionTypeObject = null;
+ private String[] serviceDependencies = null;
+ private String serviceEndpoint = null; // generated in submit
+
+ @Override
+ public DuccId getDuccId() {
+ return duccId;
+ }
+
+ @Override
+ public void setDuccId(DuccId duccId) {
+ this.duccId = duccId;
+ }
+
+ @Override
+ public String getId() {
+ return duccId.toString();
+ }
+
+ @Override
+ public int getHashCode() {
+ return duccId.hashCode();
+ }
+
+ @Override
+ public DuccType getDuccType() {
+ return duccType;
+ }
+
+ @Override
+ public void setDuccType(DuccType duccType) {
+ this.duccType = duccType;
+ }
+
+ @Override
+ public IDuccStandardInfo getStandardInfo() {
+ return duccStandardInfo;
+ }
+
+ @Override
+ public void setStandardInfo(IDuccStandardInfo standardInfo) {
+ this.duccStandardInfo = standardInfo;;
+ }
+
+ @Override
+ public IDuccSchedulingInfo getSchedulingInfo() {
+ return duccSchedulingInfo;
+ }
+
+ @Override
+ public void setSchedulingInfo(IDuccSchedulingInfo schedulingInfo) {
+ this.duccSchedulingInfo = schedulingInfo;
+ }
+
+ @Override
+ public Object getStateObject() {
+ return stateObject;
+ }
+
+ @Override
+ public void setStateObject(Object state) {
+ this.stateObject = state;
+ }
+
+ @Override
+ public Object getCompletionTypeObject() {
+ return completionTypeObject;
+ }
+
+ @Override
+ public void setCompletionTypeObject(Object completionType) {
+ this.completionTypeObject = completionType;
+ }
+
+ public void setServiceDependencies(String[] dependencies) {
+ this.serviceDependencies = dependencies;
+ }
+
+ public String[] getServiceDependencies() {
+ return this.serviceDependencies;
+ }
+
+ public void setServiceEndpoint(String ep)
+ {
+ this.serviceEndpoint = ep;
+ }
+
+ public String getServiceEndpoint()
+ {
+ return serviceEndpoint;
+ }
+
+ public boolean isSchedulable() {
+ throw new RuntimeException("subclass must override: should never be here!");
+ }
+
+ public boolean isCompleted() {
+ throw new RuntimeException("subclass must override: should never be here!");
+ }
+
+
+ public boolean isOperational() {
+ throw new RuntimeException("subclass must override: should never be here!");
+ }
+
+ // **********
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((getDuccId() == null) ? 0 : getDuccId().hashCode());
+ result = prime * result + ((getDuccType() == null) ? 0 : getDuccType().hashCode());
+ result = prime * result + ((getStandardInfo() == null) ? 0 : getStandardInfo().hashCode());
+ result = prime * result + ((getSchedulingInfo() == null) ? 0 : getSchedulingInfo().hashCode());
+ result = prime * result + ((getStateObject() == null) ? 0 : getStateObject().hashCode());
+ result = prime * result + ((getCompletionTypeObject() == null) ? 0 : getCompletionTypeObject().hashCode());
+ result = prime * result + ((getServiceEndpoint() == null) ? 0 : getServiceEndpoint().hashCode());
+ result = prime * result + super.hashCode();
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ boolean retVal = false;
+ if(this == obj) {
+ retVal = true;
+ }
+ else if(getClass() == obj.getClass()) {
+ ADuccWork that = (ADuccWork)obj;
+ if( Util.compare(this.getStandardInfo(),that.getStandardInfo())
+ && Util.compare(this.getSchedulingInfo(),that.getSchedulingInfo())
+ && Util.compare(this.getStateObject(),that.getStateObject())
+ && Util.compare(this.getCompletionTypeObject(),that.getCompletionTypeObject())
+ && Util.compare(this.getServiceEndpoint(),that.getServiceEndpoint())
+// && super.equals(obj)
+ )
+ {
+ retVal = true;
+ }
+ }
+ return retVal;
+ }
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/ADuccWork.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/ADuccWorkExecutable.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/ADuccWorkExecutable.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/ADuccWorkExecutable.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/ADuccWorkExecutable.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,107 @@
+/*
+ * 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.uima.ducc.transport.event.common;
+
+import org.apache.uima.ducc.transport.cmdline.ICommandLine;
+
+public class ADuccWorkExecutable extends ADuccWork implements IDuccWorkExecutable {
+
+ /**
+ * please increment this sUID when removing or modifying a field
+ */
+ private static final long serialVersionUID = 1L;
+ private IDuccProcessMap processMap = new DuccProcessMap();
+ private ICommandLine commandLine = null;
+// private IDuccUimaAggregate uimaAggregate = null;
+ private IDuccUimaDeployableConfiguration uimaDeployableConfiguration = null;
+
+ @Override
+ public IDuccProcessMap getProcessMap() {
+ return processMap;
+ }
+
+ @Override
+ public void setProcessMap(IDuccProcessMap processMap) {
+ this.processMap = processMap;
+ }
+
+ @Override
+ public ICommandLine getCommandLine() {
+ return commandLine;
+ }
+
+ @Override
+ public void setCommandLine(ICommandLine commandLine) {
+ this.commandLine = commandLine;
+ }
+
+// @Override
+// public IDuccUimaAggregate getUimaAggregate() {
+// return uimaAggregate;
+// }
+//
+// @Override
+// public void setUimaAggregate(IDuccUimaAggregate uimaAggregate) {
+// this.uimaAggregate = uimaAggregate;
+// }
+
+ // **********
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((getProcessMap() == null) ? 0 : getProcessMap().hashCode());
+ result = prime * result + ((getCommandLine() == null) ? 0 : getCommandLine().hashCode());
+ result = prime * result + ((getUimaDeployableConfiguration() == null) ? 0 : getUimaDeployableConfiguration().hashCode());
+ result = prime * result + super.hashCode();
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ boolean retVal = false;
+ if(this == obj) {
+ retVal = true;
+ }
+ else if(getClass() == obj.getClass()) {
+ ADuccWorkExecutable that = (ADuccWorkExecutable)obj;
+ if( Util.compare(this.getProcessMap(),that.getProcessMap())
+ && Util.compare(this.getCommandLine(),that.getCommandLine())
+ && Util.compare(this.getUimaDeployableConfiguration(),that.getUimaDeployableConfiguration())
+// && super.equals(obj)
+ )
+ {
+ retVal = true;
+ }
+ }
+
+
+ return retVal;
+ }
+
+ public IDuccUimaDeployableConfiguration getUimaDeployableConfiguration() {
+ return uimaDeployableConfiguration;
+ }
+
+ public void setUimaDeployableConfiguration(
+ IDuccUimaDeployableConfiguration uimaDeployableConfiguration) {
+ this.uimaDeployableConfiguration = uimaDeployableConfiguration;
+ }
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/ADuccWorkExecutable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DefaultJobManagerStateReconciler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DefaultJobManagerStateReconciler.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DefaultJobManagerStateReconciler.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DefaultJobManagerStateReconciler.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,99 @@
+/*
+ * 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.uima.ducc.transport.event.common;
+
+import java.util.Map;
+
+import org.apache.uima.ducc.common.utils.DuccCollectionUtils;
+import org.apache.uima.ducc.common.utils.DuccLogger;
+import org.apache.uima.ducc.common.utils.DuccCollectionUtils.DuccMapDifference;
+import org.apache.uima.ducc.common.utils.DuccCollectionUtils.DuccMapValueDifference;
+import org.apache.uima.ducc.common.utils.id.DuccId;
+
+import com.google.common.base.Preconditions;
+
+public class DefaultJobManagerStateReconciler implements
+ JobManagerStateReconciler {
+
+ private WorkChangesHandler jobChangesCallback;
+ private WorkProcessChangesHandler processChangesCallback;
+ private DuccLogger logger;
+ public DefaultJobManagerStateReconciler(DuccLogger logger) {
+ this.logger = logger;
+ }
+ public void reconcile(Map<DuccId, IDuccWork> left, Map<DuccId, IDuccWork> right) {
+ Preconditions.checkNotNull(jobChangesCallback, "JobChangesHandler Callback not Specified");
+ Preconditions.checkNotNull(processChangesCallback, "JobProcessChangesHandler Callback not Specified");
+ @SuppressWarnings("unchecked")
+ DuccMapDifference<DuccId, IDuccWork>
+ jobDifferenceMap = DuccCollectionUtils.difference(left, right);
+// if ( jobDifferenceMap.getDifferingMap() != null && jobDifferenceMap.getDifferingMap().size() > 0 ) {
+ try {
+// logger.info("DefaultJobManagerStateReconciler.reconcile", null, "Job Difference Map Size:"+jobDifferenceMap.getDifferingMap().size()+" New Orchestrator State:\n"+XStreamUtils.marshall(left));
+ // getLeft() returns Jobs that are in JobManager state Map only. These jobs will be added to the
+ // local state Map
+ //logger.info("DefaultJobManagerStateReconciler.reconcile", null,"..........Calling onNewWork\n:"+XStreamUtils.marshall(jobDifferenceMap.getLeft()));
+ jobChangesCallback.onNewWork(jobDifferenceMap.getLeft());
+ // getRight() returns Jobs that are in local state Map only. These jobs will be removed from the
+ // local state Map
+ jobChangesCallback.onRemovedWork(jobDifferenceMap.getRight());
+
+ // Find differences between corresponding Jobs (existing in both Job Maps)
+ for( DuccMapValueDifference<IDuccWork> jd : jobDifferenceMap ) {
+ // getLeft() returns a Job with a different internal state from a Job from the getRight()
+ jobChangesCallback.onWorkChanges(jd.getLeft(), jd.getRight());
+ }
+
+
+ // For jobs common to both Maps, iterate over diffs in respective Process Maps
+ for( DuccMapValueDifference<IDuccWork> jd: jobDifferenceMap ) {
+ // Job Process Maps dont match, find what Processes have added or deleted by diffing respective Process Maps
+ @SuppressWarnings("unchecked")
+ DuccMapDifference<DuccId, IDuccProcess>
+ processDifference = DuccCollectionUtils.
+ difference(((IDuccWorkExecutable)jd.getLeft()).getProcessMap().getMap(), ((IDuccWorkExecutable)jd.getRight()).getProcessMap());
+ // getLeft() returns Processes added
+ if ( processDifference.getLeft().size() > 0 ) {
+// processChangesCallback.onNewWorkProcesses(jd.getLeft().getDuccId(),((IDuccWorkExecutable)jd.getLeft()).getCommandLine(), processDifference.getLeft(),((IDuccWorkExecutable)jd.getRight()).getProcessMap().getMap());
+ processChangesCallback.onNewWorkProcesses(jd.getLeft(),((IDuccWorkExecutable)jd.getLeft()).getCommandLine(), processDifference.getLeft(),((IDuccWorkExecutable)jd.getRight()).getProcessMap().getMap());
+ }
+ // getRight() returns Processes removed
+ if ( processDifference.getRight().size() > 0 ) {
+ processChangesCallback.onRemovedWorkProcesses(jd.getLeft().getDuccId(), processDifference.getRight(),((IDuccWorkExecutable)jd.getRight()).getProcessMap().getMap());
+ }
+ // For Processes common to both Process Maps, handle Process state changes
+ for( DuccMapValueDifference<IDuccProcess> pd : processDifference ) {
+ processChangesCallback.onProcessChanges(jd.getLeft(),pd.getLeft(), pd.getRight());
+ }
+ }
+ } catch( Exception e) {
+ logger.error("DefaultJobManagerStateReconciler.reconcile", null, e);
+ }
+ //}
+ }
+
+ public void setWorkChangesHandler(WorkChangesHandler callback) {
+ this.jobChangesCallback = callback;
+ }
+
+ public void setWorkProcessChanges(WorkProcessChangesHandler callback) {
+ this.processChangesCallback = callback;
+ }
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DefaultJobManagerStateReconciler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccJobDeployment.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccJobDeployment.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccJobDeployment.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccJobDeployment.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,73 @@
+/*
+ * 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.uima.ducc.transport.event.common;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.ducc.common.utils.id.DuccId;
+import org.apache.uima.ducc.transport.cmdline.ICommandLine;
+import org.apache.uima.ducc.transport.cmdline.JavaCommandLine;
+
+
+public class DuccJobDeployment implements IDuccJobDeployment {
+ private static final long serialVersionUID = 1L;
+ private DuccId jobId;
+ // at most two command lines can be accommodated
+ private ICommandLine[] jclArray = new JavaCommandLine[2];
+ private IDuccStandardInfo stdInfo;
+ private List<IDuccProcess> jobProcesses = new ArrayList<IDuccProcess>();
+ private long processMemoryAssignment;
+
+ public DuccJobDeployment( DuccId jobId, ICommandLine jdCmdLine, ICommandLine jpCmdLine,
+ IDuccStandardInfo stdInfo, IDuccProcess jdProcess, long processMemoryAssignment, List<IDuccProcess> jps ) {
+ this.jobId = jobId;
+ this.jclArray[0] = jdCmdLine;
+ this.jclArray[1] = jpCmdLine;
+ this.stdInfo = stdInfo;
+ this.jobProcesses.add(jdProcess);
+ this.jobProcesses.addAll(jps);
+ this.processMemoryAssignment = processMemoryAssignment;
+ }
+ public ICommandLine getJdCmdLine() {
+ return this.jclArray[0];
+ }
+
+ public ICommandLine getJpCmdLine() {
+ return this.jclArray[1];
+ }
+
+ public IDuccStandardInfo getStandardInfo() {
+ return this.stdInfo;
+ }
+
+ public IDuccProcess getJdProcess() {
+ return this.jobProcesses.get(0);
+ }
+
+ public List<IDuccProcess> getJpProcessList() {
+ return this.jobProcesses.subList(1, this.jobProcesses.size());
+ }
+ public DuccId getJobId() {
+ return jobId;
+ }
+ public long getProcessMemoryAssignment() {
+ return processMemoryAssignment;
+ }
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccJobDeployment.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccPerWorkItemStatistics.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccPerWorkItemStatistics.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccPerWorkItemStatistics.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccPerWorkItemStatistics.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,60 @@
+/*
+ * 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.uima.ducc.transport.event.common;
+
+public class DuccPerWorkItemStatistics implements IDuccPerWorkItemStatistics {
+
+ /**
+ * please increment this sUID when removing or modifying a field
+ */
+ private static final long serialVersionUID = 1L;
+
+ private double max = 0;
+ private double min = 0;
+ private double mean = 0;
+ private double stddev = 0;
+
+ public DuccPerWorkItemStatistics(double max, double min, double mean, double stddev) {
+ this.max = max;
+ this.min = min;
+ this.mean = mean;
+ this.stddev = stddev;
+ }
+
+ @Override
+ public double getMax() {
+ return max;
+ }
+
+ @Override
+ public double getMin() {
+ return min;
+ }
+
+ @Override
+ public double getMean() {
+ return mean;
+ }
+
+ @Override
+ public double getStandardDeviation() {
+ return stddev;
+ }
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccPerWorkItemStatistics.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcess.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcess.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcess.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcess.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,477 @@
+/*
+ * 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.uima.ducc.transport.event.common;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.ducc.common.NodeIdentity;
+import org.apache.uima.ducc.common.node.metrics.ProcessGarbageCollectionStats;
+import org.apache.uima.ducc.common.utils.id.DuccId;
+import org.apache.uima.ducc.transport.agent.IUimaPipelineAEComponent;
+import org.apache.uima.ducc.transport.event.common.IDuccProcessType.ProcessType;
+import org.apache.uima.ducc.transport.event.common.IProcessState.ProcessState;
+import org.apache.uima.ducc.transport.event.common.IResourceState.ProcessDeallocationType;
+import org.apache.uima.ducc.transport.event.common.IResourceState.ResourceState;
+
+
+public class DuccProcess implements IDuccProcess {
+
+ /**
+ * please increment this sUID when removing or modifying a field
+ */
+ private static final long serialVersionUID = 1L;
+ private DuccId duccId = null;
+ private NodeIdentity nodeIdentity = null;
+ private String pid = null;
+ private ProcessState processState = ProcessState.Undefined;
+ private ResourceState resourceState = ResourceState.Undefined;
+ private ProcessDeallocationType deallocationType = ProcessDeallocationType.Undefined;
+ private ITimeWindow timeWindowInit = null;
+ private ITimeWindow timeWindowRun = null;
+ private long residentMemory=0;
+ private long residentMemoryMax=0;
+ private ProcessType processType;
+ private List<IUimaPipelineAEComponent> uimaPipelineComponentList =
+ new ArrayList<IUimaPipelineAEComponent>(); // empty list
+ private ProcessGarbageCollectionStats gcStats=null;
+ private String processJmxUrl;
+ private IDuccProcessWorkItems processWorkItems= null;
+ private long cpuUsage;
+ private String reason;
+ private boolean initialized = false;
+
+ public DuccProcess(DuccId duccId, NodeIdentity nodeIdentity) {
+ setDuccId(duccId);
+ setNodeIdentity(nodeIdentity);
+ }
+
+ public DuccProcess(DuccId duccId, NodeIdentity nodeIdentity, ProcessType processType) {
+ setDuccId(duccId);
+ setNodeIdentity(nodeIdentity);
+ setProcessType(processType);
+ }
+
+ public List<IUimaPipelineAEComponent> getUimaPipelineComponents() {
+ return uimaPipelineComponentList;
+ }
+
+ public void setUimaPipelineComponents(List<IUimaPipelineAEComponent> uimaPipelineComponentList) {
+ this.uimaPipelineComponentList = uimaPipelineComponentList;
+ }
+
+ @Override
+ public DuccId getDuccId() {
+ return duccId;
+ }
+
+ @Override
+ public void setDuccId(DuccId duccId) {
+ this.duccId = duccId;
+ }
+
+ @Override
+ public NodeIdentity getNodeIdentity() {
+ return nodeIdentity;
+ }
+
+ @Override
+ public void setNodeIdentity(NodeIdentity nodeIdentity) {
+ this.nodeIdentity = nodeIdentity;
+ }
+
+ @Override
+ public String getPID() {
+ return pid;
+ }
+
+ @Override
+ public void setPID(String pid) {
+ this.pid = pid;
+ }
+
+ @Override
+ public ProcessState getProcessState() {
+ return processState;
+ }
+
+ @Override
+ public void setProcessState(ProcessState processState) {
+ this.processState = processState;
+ }
+
+/*
+ Starting, // Process Manager sent request to start the Process
+ Initializing, // Process Agent is initializing process
+ Running, // Process Agent is available for processing work items
+ Stopped, // Process Agent reports process stopped
+ Failed, // Process Agent reports process failed
+ FailedInitialization, // Process Agent reports process failed initialization
+ InitializationTimeout, // Process Agent reports process initialization timeout
+ Killed, // Agent forcefully killed the process
+ Undefined
+*/
+ @Override
+ public void advanceProcessState(ProcessState nextProcessState) {
+ switch(getProcessState()) {
+ case Starting:
+ switch(nextProcessState) {
+ case Undefined:
+ case Starting:
+ break;
+ default:
+ setProcessState(nextProcessState);
+ break;
+ }
+ break;
+ case Initializing:
+ switch(nextProcessState) {
+ case Undefined:
+ case Starting:
+ case Initializing:
+ break;
+ default:
+ setProcessState(nextProcessState);
+ break;
+ }
+ break;
+ case Running:
+ switch(nextProcessState) {
+ case Undefined:
+ case Starting:
+ case Initializing:
+ case Running:
+ break;
+ default:
+ setProcessState(nextProcessState);
+ break;
+ }
+ break;
+ case Stopped:
+ case Failed:
+ case FailedInitialization:
+ case InitializationTimeout:
+ case Killed:
+ break;
+ case Undefined:
+ default:
+ switch(nextProcessState) {
+ case Undefined:
+ break;
+ default:
+ setProcessState(nextProcessState);
+ break;
+ }
+ break;
+ }
+ }
+
+ @Override
+ public ResourceState getResourceState() {
+ return resourceState;
+ }
+
+ @Override
+ public void setResourceState(ResourceState resourceState) {
+ this.resourceState = resourceState;
+ }
+
+ @Override
+ public ProcessDeallocationType getProcessDeallocationType() {
+ return deallocationType;
+ }
+
+ @Override
+ public void setProcessDeallocationType(ProcessDeallocationType deallocationType) {
+ this.deallocationType = deallocationType;
+ }
+
+ @Override
+ public ITimeWindow getTimeWindowInit() {
+ return timeWindowInit;
+ }
+
+ @Override
+ public void setTimeWindowInit(ITimeWindow timeWindow) {
+ this.timeWindowInit = timeWindow;
+ }
+
+ @Override
+ public ITimeWindow getTimeWindowRun() {
+ return timeWindowRun;
+ }
+
+ @Override
+ public void setTimeWindowRun(ITimeWindow timeWindow) {
+ this.timeWindowRun = timeWindow;
+ }
+
+ @Override
+ public boolean stateChange(ProcessState state) {
+ boolean retVal = false;
+ if(retVal==false) {
+ throw new RuntimeException("not implemented");
+ }
+ return retVal;
+ }
+
+ @Override
+ public boolean isActive() {
+ boolean retVal = false;
+ switch(processState) {
+ case Initializing:
+ case Running:
+ retVal = true;
+ break;
+ }
+ return retVal;
+ }
+
+ @Override
+ public boolean isReady() {
+ boolean retVal = false;
+ switch(processState) {
+ case Running:
+ retVal = true;
+ break;
+ }
+ return retVal;
+ }
+
+ @Override
+ public boolean isFailed() {
+ boolean retVal = false;
+ switch(processState) {
+ case Failed:
+ case Killed:
+ retVal = true;
+ break;
+ case Stopped:
+ String reason = getReasonForStoppingProcess();
+ if(reason != null) {
+ if(reason.equals("FailedInitialization")) {
+ retVal = true;
+ }
+ else if(reason.equals("InitializationTimeout")) {
+ retVal = true;
+ }
+ }
+ break;
+ //TODO: Deprecated
+ case FailedInitialization:
+ //TODO: Deprecated
+ case InitializationTimeout:
+ retVal = true;
+ break;
+ }
+ return retVal;
+ }
+
+ @Override
+ public boolean isPreempted() {
+ boolean retVal = false;
+ switch(deallocationType) {
+ case Forced:
+ retVal = true;
+ break;
+ }
+ return retVal;
+ }
+
+ @Override
+ public boolean isComplete() {
+ boolean retVal = false;
+ switch(processState) {
+ case Stopped:
+ case Failed:
+ case FailedInitialization:
+ case InitializationTimeout:
+ case Killed:
+ retVal = true;
+ break;
+ }
+ return retVal;
+ }
+
+ @Override
+ public boolean isDeallocated() {
+ boolean retVal = false;
+ switch(resourceState) {
+ case Deallocated:
+ retVal = true;
+ break;
+ }
+ return retVal;
+ }
+
+ @Override
+ public boolean isDefunct() {
+ boolean retVal = false;
+ switch(resourceState) {
+ case Deallocated:
+ retVal = isComplete();
+ break;
+ }
+ return retVal;
+ }
+
+ // **********
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((getDuccId() == null) ? 0 : getDuccId().hashCode());
+ result = prime * result + ((getNodeIdentity() == null) ? 0 : getNodeIdentity().hashCode());
+ result = prime * result + ((getPID() == null) ? 0 : getPID().hashCode());
+ result = prime * result + ((getProcessState() == null) ? 0 : getProcessState().hashCode());
+ result = prime * result + ((getResourceState() == null) ? 0 : getResourceState().hashCode());
+ result = prime * result + ((getTimeWindowInit() == null) ? 0 : getTimeWindowInit().hashCode());
+ result = prime * result + ((getTimeWindowRun() == null) ? 0 : getTimeWindowRun().hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ boolean retVal = false;
+ if(this == obj) {
+ retVal = true;
+ }
+ else if(getClass() == obj.getClass()) {
+ DuccProcess that = (DuccProcess) obj;
+ if( Util.compare(this.getDuccId(),that.getDuccId())
+ && Util.compare(this.getNodeIdentity(),that.getNodeIdentity())
+ && Util.compare(this.getPID(),that.getPID())
+ && Util.compare(this.getProcessState(),that.getProcessState())
+ && Util.compare(this.getResourceState(),that.getResourceState())
+ // These changes ignored:
+ && Util.compare(this.getTimeWindowInit(),that.getTimeWindowInit())
+ && Util.compare(this.getTimeWindowRun(),that.getTimeWindowRun())
+// && super.equals(obj)
+ )
+ {
+ retVal = true;
+ }
+ }
+ return retVal;
+ }
+
+ public void setResidentMemory(long residentMemory) {
+ if(residentMemory > this.residentMemoryMax) {
+ this.residentMemoryMax = residentMemory;
+ }
+ this.residentMemory = residentMemory;
+ }
+
+ public long getResidentMemory() {
+ return residentMemory;
+ }
+
+ public long getResidentMemoryMax() {
+ long retVal = 0;
+ try {
+ retVal = residentMemoryMax;
+ }
+ catch(Exception e) {
+ }
+ return retVal;
+ }
+
+ /**
+ * @return the processType
+ */
+ public ProcessType getProcessType() {
+ return processType;
+ }
+
+ /**
+ * @param processType the processType to set
+ */
+ public void setProcessType(ProcessType processType) {
+ this.processType = processType;
+ }
+
+ /**
+ * @param ProcessGarbageCollectionStats - this process GC stats
+ */
+ public void setGarbageCollectionStats(ProcessGarbageCollectionStats gcStats) {
+ this.gcStats = gcStats;
+ }
+ /**
+ * @param ProcessGarbageCollectionStats - this process GC stats
+ */
+ public ProcessGarbageCollectionStats getGarbageCollectionStats() {
+ return this.gcStats;
+ }
+ /**
+ * @param processJmxUrl - this process jmx connect URL.
+ */
+ public void setProcessJmxUrl(String processJmxUrl) {
+ this.processJmxUrl = processJmxUrl;
+ }
+
+ /**
+ * @return the processJmxUrl, connect URL for connecting jconsole
+ * to this process.
+ */
+ public String getProcessJmxUrl() {
+ return processJmxUrl;
+ }
+
+ @Override
+ public IDuccProcessWorkItems getProcessWorkItems() {
+ return processWorkItems;
+ }
+
+ @Override
+ public void setProcessWorkItems(IDuccProcessWorkItems processWorkItems) {
+ this.processWorkItems = processWorkItems;
+ }
+
+ public void setCpuTime(long cpuTime) {
+ this.cpuUsage = cpuTime;
+ }
+
+ public long getCpuTime() {
+ return cpuUsage;
+ }
+
+ public String getReasonForStoppingProcess() {
+ return reason;
+ }
+
+ public void setReasonForStoppingProcess(String reason) {
+ this.reason = reason;
+ }
+
+ @Override
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Override
+ public void setInitialized() {
+ initialized = true;
+ }
+
+ @Override
+ public void resetInitialized() {
+ initialized = false;
+ }
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcess.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessMap.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessMap.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessMap.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessMap.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,305 @@
+/*
+ * 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.uima.ducc.transport.event.common;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.commons.lang.SerializationUtils;
+import org.apache.uima.ducc.common.NodeIdentity;
+import org.apache.uima.ducc.common.utils.DuccLogger;
+import org.apache.uima.ducc.common.utils.id.DuccId;
+import org.apache.uima.ducc.transport.event.common.IDuccProcess.ReasonForStoppingProcess;
+import org.apache.uima.ducc.transport.event.common.IProcessState.ProcessState;
+
+
+public class DuccProcessMap extends TreeMap<DuccId,IDuccProcess> implements IDuccProcessMap {
+
+ /**
+ * please increment this sUID when removing or modifying a field
+ */
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void addProcess(IDuccProcess process) {
+ synchronized(this) {
+ put(process.getDuccId(),process);
+ }
+ }
+
+ @Override
+ public IDuccProcess getProcess(DuccId duccId) {
+ synchronized(this) {
+ return get(duccId);
+ }
+ }
+
+ @Override
+ public void removeProcess(DuccId duccId) {
+ synchronized(this) {
+ remove(duccId);
+ }
+ }
+
+ @Override
+ public IDuccProcess findProcess(String nodeIP, String processId) {
+ IDuccProcess retVal = null;
+ synchronized(this) {
+ Iterator<IDuccProcess> iterator = values().iterator();
+ while(iterator.hasNext()) {
+ IDuccProcess duccProcess = iterator.next();
+ NodeIdentity nodeIdentity = duccProcess.getNodeIdentity();
+ if(nodeIdentity != null) {
+ String IP = nodeIdentity.getIp();
+ if(IP != null) {
+ String PID = duccProcess.getPID();
+ if(PID != null ) {
+ if(IP.equals(nodeIP)) {
+ if(PID.equals(processId)) {
+ retVal = duccProcess;
+ break;
+ }
+
+ }
+ }
+ }
+ }
+ }
+ }
+ return retVal;
+ }
+
+ public IDuccProcess findProcess(DuccLogger duccLogger, String nodeIP, String processId) {
+ String methodName = "findProcess";
+ duccLogger.debug(methodName, null, "enter");
+ IDuccProcess retVal = null;
+ duccLogger.debug(methodName, null, "input nodeIP:"+nodeIP+" "+"processId:"+processId);
+ synchronized(this) {
+ Iterator<IDuccProcess> iterator = values().iterator();
+ duccLogger.debug(methodName, null, "iterator:"+iterator);
+ while(iterator.hasNext()) {
+ IDuccProcess duccProcess = iterator.next();
+ duccLogger.debug(methodName, null, "duccProcess:"+duccProcess);
+ NodeIdentity nodeIdentity = duccProcess.getNodeIdentity();
+ duccLogger.debug(methodName, null, "nodeIdentity:"+nodeIdentity);
+ String IP = nodeIdentity.getIp();
+ duccLogger.debug(methodName, null, "IP:"+IP);
+ String PID = duccProcess.getPID();
+ duccLogger.debug(methodName, null, "PID:"+PID);
+ if(Util.compareNotNull(IP, nodeIP)) {
+ if(Util.compareNotNull(PID,processId)) {
+ retVal = duccProcess;
+ duccLogger.debug(methodName, null, "retVal:"+retVal);
+ break;
+ }
+ else {
+ duccLogger.debug(methodName, null, ">"+PID+"<");
+ duccLogger.debug(methodName, null, ">"+processId+"<");
+ }
+ }
+ else {
+ duccLogger.debug(methodName, null, ">"+IP+"<");
+ duccLogger.debug(methodName, null, ">"+nodeIP+"<");
+ }
+ }
+ }
+ duccLogger.debug(methodName, null, "exit");
+ return retVal;
+ }
+
+ /*
+ @Override
+ public int getFailedProcessCount() {
+ int retVal = 0;
+ synchronized(this) {
+ Iterator<IDuccProcess> iterator = this.values().iterator();
+ while(iterator.hasNext()) {
+ IDuccProcess process = iterator.next();
+ if(process.isFailed()) {
+ retVal++;
+ }
+ }
+ }
+ return retVal;
+ }
+ */
+
+ @Override
+ public int getFailedUnexpectedProcessCount() {
+ int retVal = 0;
+ synchronized(this) {
+ Iterator<IDuccProcess> iterator = this.values().iterator();
+ while(iterator.hasNext()) {
+ IDuccProcess process = iterator.next();
+ if(process.isFailed()) {
+ switch(process.getProcessDeallocationType()) {
+ case Forced:
+ continue;
+ }
+ retVal++;
+ }
+ }
+ }
+ return retVal;
+ }
+
+ @Override
+ public int getReadyProcessCount() {
+ int retVal = 0;
+ synchronized(this) {
+ Iterator<IDuccProcess> iterator = this.values().iterator();
+ while(iterator.hasNext()) {
+ IDuccProcess process = iterator.next();
+ if(process.isReady()) {
+ retVal++;
+ }
+ }
+
+ }
+ return retVal;
+ }
+
+ @Override
+ public int getUsableProcessCount() {
+ int retVal = 0;
+ synchronized(this) {
+ Iterator<IDuccProcess> iterator = this.values().iterator();
+ while(iterator.hasNext()) {
+ IDuccProcess process = iterator.next();
+ if(process.isDeallocated()) {
+ continue;
+ }
+ if(process.isReady()) {
+ retVal++;
+ }
+ }
+ }
+ return retVal;
+ }
+
+ @Override
+ public int getAliveProcessCount() {
+ int retVal = 0;
+ synchronized(this) {
+ Iterator<IDuccProcess> iterator = this.values().iterator();
+ while(iterator.hasNext()) {
+ IDuccProcess process = iterator.next();
+ if(!process.isDefunct()) {
+ retVal++;
+ }
+ }
+
+ }
+ return retVal;
+ }
+
+ @Override
+ public Map<DuccId, IDuccProcess> getMap() {
+ return this;
+ }
+
+ @Override
+ public IDuccProcessMap deepCopy() {
+ synchronized (this) {
+ return (IDuccProcessMap) SerializationUtils.clone(this);
+ }
+ }
+
+
+ @Override
+ public ArrayList<DuccId> getFailedInitialization() {
+ ArrayList<DuccId> list = new ArrayList<DuccId>();
+ String failedInitialization = ReasonForStoppingProcess.FailedInitialization.toString().trim();
+ String initializationTimeout = ReasonForStoppingProcess.InitializationTimeout.toString().trim();
+ synchronized(this) {
+ Iterator<IDuccProcess> iterator = this.values().iterator();
+ while(iterator.hasNext()) {
+ IDuccProcess process = iterator.next();
+ ProcessState processState = process.getProcessState();
+ String reason = process.getReasonForStoppingProcess();
+ switch(processState) {
+ case Failed:
+ case Killed:
+ case Stopped:
+ if(reason != null) {
+ reason = reason.trim();
+ if(reason.equals(failedInitialization)) {
+ list.add(process.getDuccId());
+ }
+ else if(reason.equals(initializationTimeout)) {
+ list.add(process.getDuccId());
+ }
+ }
+ break;
+ }
+ }
+ }
+ return list;
+ }
+
+ @Override
+ public ArrayList<DuccId> getFailedNotInitialization() {
+ ArrayList<DuccId> list = new ArrayList<DuccId>();
+ String failedInitialization = ReasonForStoppingProcess.FailedInitialization.toString().trim();
+ String initializationTimeout = ReasonForStoppingProcess.InitializationTimeout.toString().trim();
+ synchronized(this) {
+ Iterator<IDuccProcess> iterator = this.values().iterator();
+ while(iterator.hasNext()) {
+ IDuccProcess process = iterator.next();
+ ProcessState processState = process.getProcessState();
+ String reason = process.getReasonForStoppingProcess();
+ switch(processState) {
+ case Failed:
+ case Stopped:
+ case Killed:
+ if(reason != null) {
+ reason = reason.trim();
+ if(reason.equals("")) {
+ continue;
+ }
+ if(reason.equals(failedInitialization)) {
+ continue;
+ }
+ else if(reason.equals(initializationTimeout)) {
+ continue;
+ }
+ list.add(process.getDuccId());
+ }
+ break;
+ }
+ }
+ }
+ return list;
+ }
+
+ @Override
+ public int getFailedInitializationCount() {
+ ArrayList<DuccId> list = getFailedInitialization();
+ return list.size();
+ }
+
+ @Override
+ public int getFailedNotInitializationCount() {
+ ArrayList<DuccId> list = getFailedNotInitialization();
+ return list.size();
+ }
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessWorkItems.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessWorkItems.java?rev=1427978&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessWorkItems.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessWorkItems.java Wed Jan 2 19:49:53 2013
@@ -0,0 +1,229 @@
+/*
+ * 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.uima.ducc.transport.event.common;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+public class DuccProcessWorkItems implements IDuccProcessWorkItems {
+
+ private static final long serialVersionUID = 1L;
+
+ private AtomicLong dispatch = new AtomicLong(0);
+ private AtomicLong done = new AtomicLong(0);
+ private AtomicLong error = new AtomicLong(0);
+ private AtomicLong retry = new AtomicLong(0);
+ private AtomicLong preempt = new AtomicLong(0);
+ private AtomicLong completedMillisTotal = new AtomicLong(0);
+ private AtomicLong completedMillisMax = new AtomicLong(0);
+ private AtomicLong completedMillisMin = new AtomicLong(0);
+
+ private void setMin(long update) {
+ completedMillisMin.compareAndSet(0, update);
+ while(true) {
+ long min = completedMillisMin.get();
+ if(update < min) {
+ completedMillisMin.compareAndSet(min, update);
+ }
+ else {
+ break;
+ }
+ }
+ }
+
+ private void setMax(long update) {
+ completedMillisMax.compareAndSet(0, update);
+ while(true) {
+ long max = completedMillisMax.get();
+ if(update > max) {
+ completedMillisMax.compareAndSet(max, update);
+ }
+ else {
+ break;
+ }
+ }
+ }
+
+ public void done(long delta) {
+ done.incrementAndGet();
+ completedMillisTotal.addAndGet(delta);
+ setMin(delta);
+ setMax(delta);
+ undispatch();
+ }
+
+ public void error() {
+ error.incrementAndGet();
+ undispatch();
+ }
+
+ public void retry() {
+ retry.incrementAndGet();
+ undispatch();
+ }
+
+ public void preempt() {
+ preempt.incrementAndGet();
+ undispatch();
+ }
+
+ public void dispatch() {
+ dispatch.incrementAndGet();
+ }
+
+ private void undispatch() {
+ dispatch.decrementAndGet();
+ }
+
+ @Override
+ public long getCountDispatch() {
+ long retVal = 0;
+ try {
+ retVal = dispatch.get();
+ }
+ catch(Throwable t) {
+ }
+ return retVal;
+ }
+
+ @Override
+ public long getCountDone() {
+ long retVal = 0;
+ try {
+ retVal = done.get();
+ }
+ catch(Throwable t) {
+ }
+ return retVal;
+ }
+
+ @Override
+ public long getCountError() {
+ long retVal = 0;
+ try {
+ retVal = error.get();
+ }
+ catch(Throwable t) {
+ }
+ return retVal;
+ }
+
+ @Override
+ public long getCountRetry() {
+ long retVal = 0;
+ try {
+ retVal = retry.get();
+ }
+ catch(Throwable t) {
+ }
+ return retVal;
+ }
+
+ @Override
+ public long getCountPreempt() {
+ long retVal = 0;
+ try {
+ retVal = preempt.get();
+ }
+ catch(Throwable t) {
+ }
+ return retVal;
+ }
+
+ @Override
+ public long getSecsAvg() {
+ long retVal = 0;
+ try {
+ long count = done.get();
+ if(count > 0) {
+ double msecs = (double)completedMillisTotal.get() / (double)count;
+ retVal = (long)(msecs/1000);
+ }
+ }
+ catch(Throwable t) {
+ }
+ return retVal;
+ }
+
+ @Override
+ public long getSecsMax() {
+ long retVal = 0;
+ try {
+ double msecs = (double)completedMillisMax.get();
+ retVal = (long)(msecs/1000);
+ }
+ catch(Throwable t) {
+ }
+ return retVal;
+ }
+
+ @Override
+ public long getSecsMin() {
+ long retVal = 0;
+ try {
+ double msecs = (double)completedMillisMin.get();
+ retVal = (long)(msecs/1000);
+ }
+ catch(Throwable t) {
+ }
+ return retVal;
+ }
+
+ // <test>
+
+ private static void stats(DuccProcessWorkItems pwi) {
+ System.out.println(" done: "+pwi.getCountDone());
+ System.out.println(" error: "+pwi.getCountError());
+ System.out.println(" retry: "+pwi.getCountRetry());
+ System.out.println(" dispatch: "+pwi.getCountDispatch());
+ System.out.println("avg(secs): "+pwi.getSecsAvg());
+ System.out.println("min(secs): "+pwi.getSecsMin());
+ System.out.println("max(secs): "+pwi.getSecsMax());
+ }
+
+ private static void done(DuccProcessWorkItems pwi, int msecs) {
+ pwi.dispatch();
+ pwi.done(msecs);
+ }
+
+ private static void error(DuccProcessWorkItems pwi) {
+ pwi.dispatch();
+ pwi.error();
+ }
+
+ private static void retry(DuccProcessWorkItems pwi) {
+ pwi.dispatch();
+ pwi.retry();
+ }
+
+ public static void main(String[] args) {
+ DuccProcessWorkItems pwi = new DuccProcessWorkItems();
+ pwi.dispatch();
+ done(pwi,30000);
+ done(pwi,40000);
+ for(int i=0; i<9; i++) {
+ error(pwi);
+ }
+ for(int i=0; i<4; i++) {
+ retry(pwi);
+ }
+ stats(pwi);
+ }
+
+ // </test>
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessWorkItems.java
------------------------------------------------------------------------------
svn:eol-style = native