From 0ebbf00604d2edfabe3ef8b66bf79be7fde0e88e Mon Sep 17 00:00:00 2001 From: Khai Do Date: Sun, 11 Aug 2013 07:16:12 -0700 Subject: [PATCH] moved python examples to jenkins wiki Removed python examples from this java project. The examples were using the python 'gearman' library. New examples using jeblair's 'gear' library have been created on the jenkins gearman plugin wiki at https://wiki.jenkins-ci.org/display/JENKINS/Gearman+Plugin changed to python 'gear' because it's better than the gearman library. Change-Id: I54f2d2a52f6b2eaf2f15433aee62525d5b3621b6 --- .../plugins/gearman/example/StartJobClient.py | 49 ------------------- .../plugins/gearman/example/StopJobClient.py | 48 ------------------ 2 files changed, 97 deletions(-) delete mode 100644 src/main/java/hudson/plugins/gearman/example/StartJobClient.py delete mode 100644 src/main/java/hudson/plugins/gearman/example/StopJobClient.py diff --git a/src/main/java/hudson/plugins/gearman/example/StartJobClient.py b/src/main/java/hudson/plugins/gearman/example/StartJobClient.py deleted file mode 100644 index 7f7d5f3..0000000 --- a/src/main/java/hudson/plugins/gearman/example/StartJobClient.py +++ /dev/null @@ -1,49 +0,0 @@ -''' - - Copyright 2013 Hewlett-Packard Development Company, L.P. - - Licensed 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. - -''' - -''' - A python example of how to start a jenkins job using a Gearman client - - author: Khai Do -''' - - - -from gearman import GearmanClient -import simplejson -import uuid - -server = '127.0.0.1:4730' -client = GearmanClient([server]) -function = 'build:pep8:precise' -build_id = uuid.uuid4().hex -build_params = {'param1':"red", 'param2':"white", 'param3':"blue"} - -# Submit a synchronous job request to the job server -print 'Sending job ' + build_id + ' to ' + server + ' with params ' + str(build_params) -request = client.submit_job(function, - simplejson.dumps(build_params), - poll_timeout=60, - unique=build_id) - -if (request.exception) : - print request.exception -else: - print ', '.join(request.warning_updates) - print request.result - print 'Work complete with state %s' % request.state diff --git a/src/main/java/hudson/plugins/gearman/example/StopJobClient.py b/src/main/java/hudson/plugins/gearman/example/StopJobClient.py deleted file mode 100644 index 85cb0e7..0000000 --- a/src/main/java/hudson/plugins/gearman/example/StopJobClient.py +++ /dev/null @@ -1,48 +0,0 @@ -''' - - Copyright 2013 Hewlett-Packard Development Company, L.P. - - Licensed 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. - -''' - -''' - A python example of how to stop a jenkins job using a Gearman client - - author: Khai Do -''' - -from gearman import GearmanClient -import simplejson -import uuid - -server = '127.0.0.1' -port = '4730' -conn = server + ":" + port -client = GearmanClient([conn]) -function = "stop:" + server -build_id = uuid.UUID('{5ac10210-0405-0607-4809-1a0b0c0d0e0f}').hex - -# Submit a synchronous job request to the job server -print 'Sending job ' + function + ' to ' + conn + ' with id ' + build_id -request = client.submit_job(function, - "", - poll_timeout=60, - unique=build_id) - -if (request.exception) : - print request.exception -else: - print ', '.join(request.warning_updates) - print request.result - print 'Work complete with state %s' % request.state