Skip to content

Commit

Permalink
Moonray 4900 (#17)
Browse files Browse the repository at this point in the history
* stop out cgroup functions when libcgroup isn't available

* MOONRAY-4900: Add rocky-9 variants.

* MOONRAY-4900: Update to existing breakpad even though to cmake build does not use it.

* MOONRAY-4900: Converted to use libmicrohttpd for rocky-9 builds.

* MOONRAY-4900: Add rocky-9 variants.

* stop out cgroup functions when libcgroup isn't available

* MOONRAY-4900: Update to existing breakpad even though to cmake build does not use it.

* MOONRAY-4900: Converted to use libmicrohttpd for rocky-9 builds.

* MOONRAY-4952 Add CMake options to set CXX11 ABI and abi-version (#18)

* Add CMake options to set CXX11 ABI and abi-version

Signed-off-by: James Horsley <jbhorsley@gmail.com>

* Don't define _GLIBCXX_USE_CXX11_ABI

* Add option for -fabi-version

Signed-off-by: James Horsley <jbhorsley@gmail.com>
Co-authored-by: James Horsley <jbhorsley@gmail.com>

* MOONRAY-4900: Add rocky-9 variants.

* stop out cgroup functions when libcgroup isn't available

* MOONRAY-4900: Update to existing breakpad even though to cmake build does not use it.

* MOONRAY-4900: Converted to use libmicrohttpd for rocky-9 builds.

Signed-off-by: James Horsley <jbhorsley@gmail.com>
Co-authored-by: Paul Ramsey <paul.ramsey@dreawworks.com>
Co-authored-by: Jon Lanz <Jon.Lanz@dreamworks.com>
Co-authored-by: James Horsley <jbhorsley@gmail.com>
  • Loading branch information
4 people committed Jun 28, 2023
1 parent 5fd1e75 commit 8e22420
Show file tree
Hide file tree
Showing 9 changed files with 203 additions and 25 deletions.
6 changes: 5 additions & 1 deletion arras4_core_impl/lib/execute/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@ target_link_libraries(${LibName}
${PROJECT_NAME}::chunking
${PROJECT_NAME}::core_messages
${PROJECT_NAME}::network
cgroup
)

if(EXISTS /usr/lib64/libcgroup.so)
target_link_libraries(${LibName} PUBLIC cgroup)
target_compile_definitions(${LibName} PRIVATE ARRAS_ENABLE_CGROUP)
endif()

target_include_directories(${LibName}
PUBLIC
$<BUILD_INTERFACE:${BuildIncludeDir}>
Expand Down
4 changes: 4 additions & 0 deletions arras4_core_impl/lib/execute/ControlGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
#ifndef __COMPUTATION_GROUP_H__
#define __COMPUTATION_GROUP_H__

#ifdef ARRAS_ENABLE_CGROUP
#include <libcgroup.h>
#else
#include "cgroup_stubs.h"
#endif
#include <map>
#include <mutex>
#include <string> // for std::string
Expand Down
6 changes: 4 additions & 2 deletions arras4_core_impl/lib/execute/SConscript
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Import('env')
from os import path
import os

# --------------------------------------------------------------------------
name = 'execute'
Expand Down Expand Up @@ -28,7 +28,9 @@ publicHeaders = [

env.DWAInstallInclude(publicHeaders, 'execute')

env.AppendUnique(LIBS = ['cgroup'])
if os.path.isfile('/usr/lib64/libcgroup.so'):
env.AppendUnique(LIBS = ['cgroup'])
env.AppendUnique(CPPDEFINES=['ARRAS_ENABLE_CGROUP'])

env.DWAUseComponents(components)
lib = env.DWASharedLibrary(name, sources)
Expand Down
154 changes: 154 additions & 0 deletions arras4_core_impl/lib/execute/cgroup_stubs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@

enum {
ECGROUPNOTCOMPILED = 50000,
ECGEOF = 50023
};

struct cgroup {
int stub;
};

struct cgroup_controller {
int stub;
};

struct cgroup_stat {
char name[1];
char value[1];
};

inline int
cgroup_init(void)
{
return ECGROUPNOTCOMPILED;
}

inline int
cgroup_get_subsys_mount_point(const char *controller, char **mount_point)
{
return ECGROUPNOTCOMPILED;
}

inline int
cgroup_create_cgroup(struct cgroup *cgroup, int ignore_ownership)
{
return ECGROUPNOTCOMPILED;
}

inline int
cgroup_get_task_begin(const char *cgroup, const char *controller, void **handle,
pid_t *pid)
{
return 0;
}

inline int
cgroup_get_task_end(void **handle)
{
return ECGROUPNOTCOMPILED;
}

inline int
cgroup_attach_task_pid(struct cgroup *cgroup, pid_t tid)
{
return ECGROUPNOTCOMPILED;
}

inline const char *
cgroup_strerror(int code)
{
static char errorstr[] = "cgroups are disabled";
return errorstr;
}

inline struct cgroup_controller *
cgroup_get_controller(struct cgroup *cgroup, const char *name)
{
return nullptr;
}

inline struct cgroup_controller *
cgroup_add_controller(struct cgroup *cgroup,
const char *name)
{
return nullptr;
}

inline int
cgroup_get_value_uint64(struct cgroup_controller *controller,
const char *name, u_int64_t *value)
{
return ECGROUPNOTCOMPILED;
}

inline int
cgroup_get_value_int64(struct cgroup_controller *controller,
const char *name, int64_t *value)
{
return ECGROUPNOTCOMPILED;
}

inline int
cgroup_add_value_int64(struct cgroup_controller *controller,
const char *name, int64_t value)
{
return ECGROUPNOTCOMPILED;
}

inline int
cgroup_add_value_uint64(struct cgroup_controller *controller,
const char *name, u_int64_t value)
{
return ECGROUPNOTCOMPILED;
}

inline struct cgroup *
cgroup_new_cgroup(const char *name)
{
return nullptr;
}

inline int
cgroup_get_cgroup(struct cgroup *cgroup)
{
return ECGROUPNOTCOMPILED;
}

inline int
cgroup_modify_cgroup(struct cgroup *cgroup)
{
return ECGROUPNOTCOMPILED;
}

inline int
cgroup_delete_cgroup(struct cgroup *cgroup, int ignore_migration)
{
return ECGROUPNOTCOMPILED;
}

inline void
cgroup_free(struct cgroup **cgroup)
{
}

inline int
cgroup_read_stats_begin(const char *controller, const char *path, void **handle,
struct cgroup_stat *stat)
{
return ECGROUPNOTCOMPILED;
}

inline int
cgroup_read_stats_next(void **handle, struct cgroup_stat *stat)
{
return ECGROUPNOTCOMPILED;
}

inline int
cgroup_read_stats_end(void **handle)
{
return ECGROUPNOTCOMPILED;
}



12 changes: 6 additions & 6 deletions arras4_network/lib/httpserver/HttpServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ ResponseState::ResponseState(struct MHD_Connection* aConnection, const char* aUr
{
}

int
MHD_Result
handleError(struct MHD_Connection* aConnection,
unsigned int statusCode,
const std::string& responseMsg,
enum MHD_ResponseMemoryMode mode)
{
int rtn = MHD_NO;
MHD_Result rtn = MHD_NO;
struct MHD_Response* resp = MHD_create_response_from_buffer(responseMsg.size() + 1,
const_cast<char*>(responseMsg.c_str()),
mode);
Expand All @@ -73,7 +73,7 @@ handleError(struct MHD_Connection* aConnection,
return rtn;
}

int
MHD_Result
dispatch(
void* aData,
struct MHD_Connection* aConnection,
Expand Down Expand Up @@ -116,7 +116,7 @@ dispatch(
return MHD_YES;
}

int rtn = MHD_NO;
MHD_Result rtn = MHD_NO;
try {
HttpServer* server = static_cast<HttpServer*>(aData);
ResponseState* state = static_cast<ResponseState*>(*aPtr);
Expand Down Expand Up @@ -393,12 +393,12 @@ HttpServer::~HttpServer()
if (mDaemon) MHD_stop_daemon(mDaemon);
}

int
MHD_Result
HttpServer::_complete(HttpServerResponse& aResp) {
return aResp.queue();
}

static int
static MHD_Result
key_value_iterator(void* aCls, enum MHD_ValueKind aKind, const char* aKey, const char* aVal)
{

Expand Down
7 changes: 4 additions & 3 deletions arras4_network/lib/httpserver/HttpServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
#include <string>
#include <thread>

struct MHD_Daemon;
struct MHD_Connection;
#include <microhttpd.h>
// struct MHD_Daemon;
// struct MHD_Connection;

namespace arras4 {
namespace network {
Expand All @@ -37,7 +38,7 @@ namespace arras4 {

// internal-use only
void _prepare(HttpServerRequest&, struct MHD_Connection*);
int _complete(HttpServerResponse&);
MHD_Result _complete(HttpServerResponse&);

private:
MHD_Daemon* mDaemon;
Expand Down
2 changes: 1 addition & 1 deletion arras4_network/lib/httpserver/HttpServerResponse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ HttpServerResponse::write(const std::string& aStringData)
}


int
MHD_Result
HttpServerResponse::queue()
{
struct MHD_Response* response = nullptr;
Expand Down
3 changes: 2 additions & 1 deletion arras4_network/lib/httpserver/HttpServerResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define __ARRAS4_HTTPSERVERRESPONSE_H__

#include "httpserver_types.h"
#include <microhttpd.h>

struct MHD_Connection;

Expand Down Expand Up @@ -46,7 +47,7 @@ class HttpServerResponse
std::string mText;
ServerResponseCode mCode;

int queue();
MHD_Result queue();
};

}
Expand Down
34 changes: 23 additions & 11 deletions package.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def version():
"""
Increment the build in the version.
"""
_version = '4.10.2'
_version = '4.10.3'
from rezbuild import earlybind
return earlybind.version(this, _version)

Expand All @@ -35,30 +35,25 @@ def version():
['os-CentOS-7', 'refplat-vfx2019.3'],
['os-CentOS-7', 'refplat-vfx2020.3'],
['os-CentOS-7', 'refplat-vfx2021.0'],
['os-CentOS-7', 'refplat-vfx2022.0']
['os-CentOS-7', 'refplat-vfx2022.0'],
['os-rocky-9', 'refplat-vfx2021.0'],
['os-rocky-9', 'refplat-vfx2022.0'],
]

sconsTargets = {}
for variant in variants:
sconsTargets[variant[0]] = ['@install', '@doxygen']

requires = [
'uuid-1.0.0',
'boost',
'curl_no_ldap-7.49.1',
'jsoncpp-0.6.0',
'libmicrohttpd-0.9.37.x.0'
]

private_build_requires = [
build_system_pbr,
'cppunit',
'gcc'
'gcc-6.3.x|9.3.x'
]

if build_system is 'cmake':
def commands():
prependenv('CMAKE_MODULE_PATH', '{root}/lib64/cmake')
prependenv('CMAKE_PREFIX_PATH', '{root}')
prependenv('LD_LIBRARY_PATH', '{root}/lib64')
prependenv('PATH', '{root}/bin')
prependenv('ARRAS_SESSION_PATH', '{root}/sessions')
Expand All @@ -71,3 +66,20 @@ def commands():
uuid = '2625d822-f8b4-4e3d-8106-007c2b9f42c2'

config_version = 0

@early()
def requires():
# Requirements that apply to both pipeX and job environments
requires = [
'uuid-1.0.0',
'boost',
'curl_no_ldap-7.49.1.x.2',
'jsoncpp-0.6.0',
'libmicrohttpd-0.9.71.x.1',
'breakpad-1499'
]
if building:
from rezbuild import earlybind
requires.extend(earlybind.get_compiler(build_variant_requires))

return requires

0 comments on commit 8e22420

Please sign in to comment.