gorealis v2 refactor (#5)

* Changing default timeout for start maintenance.

* Upgrading dependencies to gorealis v2 and thrift  0.12.0

* Refactored to update to gorealis v2.
This commit is contained in:
Renan DelValle 2018-12-27 11:31:51 -08:00 committed by GitHub
parent ad4dd9606e
commit 6ab5c9334d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1335 changed files with 137431 additions and 61530 deletions

View file

@ -22,6 +22,7 @@
#include "FacebookService.h"
#include <boost/shared_ptr.hpp>
#include <thrift/server/TServer.h>
#include <thrift/concurrency/Mutex.h>

View file

@ -24,6 +24,7 @@
namespace java com.facebook.fb303
namespace cpp facebook.fb303
namespace perl Facebook.FB303
namespace netcore Facebook.FB303.Test
/**
* Common status reporting mechanism across all services

View file

@ -0,0 +1,5 @@
# Maven Ant tasks Jar details
mvn.ant.task.version=2.1.3
mvn.repo=http://repo1.maven.org/maven2
mvn.ant.task.url=${mvn.repo}/org/apache/maven/maven-ant-tasks/${mvn.ant.task.version}
mvn.ant.task.jar=maven-ant-tasks-${mvn.ant.task.version}.jar

View file

@ -7,9 +7,9 @@
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
@ -26,20 +26,20 @@
<property name="interface.dir" value="${basedir}/../if"/>
<property name="thrift.java.dir" location="${thrift.root}/lib/java"/>
<property name="build.tools.dir" location="${thrift.java.dir}/build/tools/"/>
<property name="thrift_compiler" value="${thrift.root}/compiler/cpp/thrift"/>
<property name="thrift_compiler" value="${thrift.root}/compiler/cpp/thrift"/>
<property file="${basedir}/build.properties"/>
<!-- inherit from the java build file for version and other properties -->
<property file="${thrift.java.dir}/build.properties" />
<property file="${thrift.java.dir}/gradle.properties" />
<property environment="env"/>
<condition property="version" value="${thrift.version}">
<isset property="release"/>
</condition>
<property name="version" value="${thrift.version}-snapshot"/>
<property name="version" value="${thrift.version}-SNAPSHOT"/>
<property name="fb303.final.name" value="${fb303.artifactid}-${version}"/>
<property name="thrift.java.libthrift" value="${thrift.java.dir}/build/libthrift-${version}.jar"/>
<property name="src" value="${basedir}/src"/>
<property name="gen" value="${basedir}/gen-java"/>
@ -74,8 +74,12 @@
<echo message="Building ${fb303.final.name}.jar"/>
<javac destdir="${build.classes.dir}" debug="on">
<classpath>
<pathelement location="${thrift.java.libthrift}"/>
<fileset dir="${thrift.root}/lib/java/build/lib">
<fileset dir="${thrift.java.dir}/build/libs">
<include name="libthrift*.jar" />
<exclude name="libthrift*javadoc.jar" />
<exclude name="libthrift*sources.jar" />
</fileset>
<fileset dir="${thrift.java.dir}/build/deps">
<include name="*.jar"/>
</fileset>
</classpath>
@ -120,19 +124,19 @@
<artifact:remoteRepository id="apache" url="${apache.repo}"/>
<!-- Pom file information -->
<artifact:pom id="pom"
groupId="${thrift.groupid}"
<artifact:pom id="pom"
groupId="${thrift.groupid}"
artifactId="${fb303.artifactid}"
version="${version}"
version="${version}"
url="http://thrift.apache.org"
name="Apache Thrift"
description="Thrift is a software framework for scalable cross-language services development."
packaging="pom"
packaging="jar"
>
<remoteRepository refid="central"/>
<remoteRepository refid="apache"/>
<license name="The Apache Software License, Version 2.0" url="${license}"/>
<scm connection="scm:git:https://git-wip-us.apache.org/repos/asf/thrift.git"
<scm connection="scm:git:https://git-wip-us.apache.org/repos/asf/thrift.git"
developerConnection="scm:git:https://git-wip-us.apache.org/repos/asf/thrift.git"
url="https://git-wip-us.apache.org/repos/asf?p=thrift.git"
/>

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
@ -19,6 +19,7 @@
# under the License.
#
from __future__ import print_function
import sys
import os
from optparse import OptionParser
@ -57,24 +58,20 @@ def service_ctrl(
msg = fb_status_string(status)
if (len(status_details)):
msg += " - %s" % status_details
print msg
if (status == fb_status.ALIVE):
return 2
else:
return 3
print(msg)
return 2 if status == fb_status.ALIVE else 3
except:
print "Failed to get status"
print("Failed to get status")
return 3
# scalar commands
if command in ["version", "alive", "name"]:
try:
result = fb303_wrapper(command, port, trans_factory, prot_factory)
print result
print(result)
return 0
except:
print "failed to get ", command
print("failed to get ", command)
return 3
# counters
@ -82,10 +79,10 @@ def service_ctrl(
try:
counters = fb303_wrapper('counters', port, trans_factory, prot_factory)
for counter in counters:
print "%s: %d" % (counter, counters[counter])
print("%s: %d" % (counter.encode('utf-8'), counters[counter]))
return 0
except:
print "failed to get counters"
print("failed to get counters")
return 3
# Only root should be able to run the following commands
@ -96,19 +93,19 @@ def service_ctrl(
fb303_wrapper(command, port, trans_factory, prot_factory)
return 0
except:
print "failed to tell the service to ", command
print("failed to tell the service to ", command)
return 3
else:
if command in ["stop", "reload"]:
print "root privileges are required to stop or reload the service."
print("root privileges are required to stop or reload the service.")
return 4
print "The following commands are available:"
print("The following commands are available:")
for command in ["counters", "name", "version", "alive", "status"]:
print "\t%s" % command
print "The following commands are available for users with root privileges:"
print("\t%s" % command)
print("The following commands are available for users with root privileges:")
for command in ["stop", "reload"]:
print "\t%s" % command
print("\t%s" % command)
return 0

View file

@ -26,7 +26,7 @@ except:
from distutils.core import setup, Extension, Command
setup(name='thrift_fb303',
version='0.10.0',
version='0.12.0',
description='Python bindings for the Apache Thrift FB303',
author=['Thrift Developers'],
author_email=['dev@thrift.apache.org'],