|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/.gitignore b/.gitignore
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 8fe6157..5a569ca 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- a/.gitignore
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/.gitignore
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -209,3 +209,4 @@ src/safefile/stamp-h1
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
src/safefile/stamp-h2
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
src/safefile/safe_id_range_list.h.in.tmp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
src/safefile/safe_id_range_list.h.tmp_out
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+src/condor_contrib/python-bindings/tests_tmp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/externals/bundles/boost/1.49.0/CMakeLists.txt b/externals/bundles/boost/1.49.0/CMakeLists.txt
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 8608ee6..dcba24b 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- a/externals/bundles/boost/1.49.0/CMakeLists.txt
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/externals/bundles/boost/1.49.0/CMakeLists.txt
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -28,6 +28,9 @@ if (NOT WINDOWS)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
if (BUILD_TESTING)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
set (BOOST_COMPONENTS unit_test_framework ${BOOST_COMPONENTS})
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
endif()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (WITH_PYTHON_BINDINGS)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ set (BOOST_COMPONENTS python ${BOOST_COMPONENTS})
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ endif()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
endif()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -104,6 +107,9 @@ if (NOT PROPER) # AND (NOT Boost_FOUND OR SYSTEM_NOT_UP_TO_SNUFF) )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
condor_pre_external( BOOST ${BOOST_FILENAME}-p2 "lib;${INCLUDE_LOC}" "done")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
set(BOOST_MIN_BUILD_DEP --with-thread --with-test)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (WITH_PYTHON_BINDINGS)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ set(BOOST_MIN_BUILD_DEP --with-python)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ endif()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
set(BOOST_PATCH echo "nothing")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
set(BOOST_INSTALL echo "nothing")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
unset(BOOST_INCLUDE)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/CMakeLists.txt b/src/condor_contrib/CMakeLists.txt
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 52f14c0..41b9002 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- a/src/condor_contrib/CMakeLists.txt
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/CMakeLists.txt
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -32,4 +32,5 @@ else(WANT_CONTRIB)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/campus_factory")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/bosco")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
085a687 |
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/lark")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/python-bindings")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
endif(WANT_CONTRIB)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/CMakeLists.txt b/src/condor_contrib/python-bindings/CMakeLists.txt
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..50d8a29
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/CMakeLists.txt
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,26 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+option(WITH_PYTHON_BINDINGS "Support for HTCondor python bindings" OFF)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+if ( WITH_PYTHON_BINDINGS )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ set ( CMAKE_LIBRARY_PATH_ORIG ${CMAKE_LIBRARY_PATH} )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ set ( CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /usr/lib64 )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ find_package(PythonLibs REQUIRED)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ set ( CMAKE_LIBRARY_PATH CMAKE_LIBRARY_PATH_ORIG)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ include_directories(${PYTHON_INCLUDE_DIRS})
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ condor_shared_lib( pyclassad classad.cpp classad_wrapper.h exprtree_wrapper.h )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ target_link_libraries( pyclassad classad ${PYTHON_LIBRARIES} -lboost_python )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ condor_shared_lib( classad_module classad_module.cpp )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ target_link_libraries( classad_module pyclassad -lboost_python ${PYTHON_LIBRARIES} )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ set_target_properties(classad_module PROPERTIES PREFIX "" OUTPUT_NAME classad )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ set_source_files_properties(dc_tool.cpp schedd.cpp PROPERTIES COMPILE_FLAGS -Wno-strict-aliasing)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ condor_shared_lib( condor condor.cpp collector.cpp config.cpp daemon_and_ad_types.cpp dc_tool.cpp export_headers.h old_boost.h schedd.cpp secman.cpp )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ target_link_libraries( condor pyclassad condor_utils -lboost_python ${PYTHON_LIBRARIES} )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ set_target_properties( condor PROPERTIES PREFIX "" )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+endif ( WITH_PYTHON_BINDINGS )
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/classad.cpp b/src/condor_contrib/python-bindings/classad.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..4c2db18
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/classad.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,341 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <string>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <classad/source.h>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <classad/sink.h>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "classad_wrapper.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "exprtree_wrapper.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ExprTreeHolder::ExprTreeHolder(const std::string &str)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ : m_expr(NULL), m_owns(true)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAdParser parser;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ExprTree *expr = NULL;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!parser.ParseExpression(str, expr))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_SyntaxError, "Unable to parse string into a ClassAd.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ m_expr = expr;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ExprTreeHolder::ExprTreeHolder(classad::ExprTree *expr)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ : m_expr(expr), m_owns(false)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ExprTreeHolder::~ExprTreeHolder()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (m_owns && m_expr) delete m_expr;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+boost::python::object ExprTreeHolder::Evaluate() const
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!m_expr)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Cannot operate on an invalid ExprTree");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::Value value;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!m_expr->Evaluate(value)) {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_SyntaxError, "Unable to evaluate expression");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::object result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string strvalue;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ long long intvalue;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ bool boolvalue;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ double realvalue;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyObject* obj;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ switch (value.GetType())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case classad::Value::BOOLEAN_VALUE:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ value.IsBooleanValue(boolvalue);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ obj = boolvalue ? Py_True : Py_False;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = boost::python::object(boost::python::handle<>(boost::python::borrowed(obj)));
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case classad::Value::STRING_VALUE:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ value.IsStringValue(strvalue);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = boost::python::str(strvalue);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case classad::Value::ABSOLUTE_TIME_VALUE:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case classad::Value::INTEGER_VALUE:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ value.IsIntegerValue(intvalue);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = boost::python::long_(intvalue);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case classad::Value::RELATIVE_TIME_VALUE:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case classad::Value::REAL_VALUE:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ value.IsRealValue(realvalue);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = boost::python::object(realvalue);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case classad::Value::ERROR_VALUE:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = boost::python::object(classad::Value::ERROR_VALUE);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case classad::Value::UNDEFINED_VALUE:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = boost::python::object(classad::Value::UNDEFINED_VALUE);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ default:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_TypeError, "Unknown ClassAd value type.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+std::string ExprTreeHolder::toRepr()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!m_expr)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Cannot operate on an invalid ExprTree");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAdUnParser up;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string ad_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ up.Unparse(ad_str, m_expr);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return ad_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+std::string ExprTreeHolder::toString()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!m_expr)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Cannot operate on an invalid ExprTree");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::PrettyPrint pp;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string ad_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ pp.Unparse(ad_str, m_expr);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return ad_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+classad::ExprTree *ExprTreeHolder::get()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!m_expr)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Cannot operate on an invalid ExprTree");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return m_expr->Copy();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+AttrPairToSecond::result_type AttrPairToSecond::operator()(AttrPairToSecond::argument_type p) const
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ExprTreeHolder holder(p.second);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (p.second->GetKind() == classad::ExprTree::LITERAL_NODE)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return holder.Evaluate();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::object result(holder);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+AttrPair::result_type AttrPair::operator()(AttrPair::argument_type p) const
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ExprTreeHolder holder(p.second);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::object result(holder);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (p.second->GetKind() == classad::ExprTree::LITERAL_NODE)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = holder.Evaluate();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return boost::python::make_tuple<std::string, boost::python::object>(p.first, result);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+boost::python::object ClassAdWrapper::LookupWrap(const std::string &attr) const
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ExprTree * expr = Lookup(attr);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!expr)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_KeyError, attr.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (expr->GetKind() == classad::ExprTree::LITERAL_NODE) return EvaluateAttrObject(attr);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ExprTreeHolder holder(expr);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::object result(holder);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+boost::python::object ClassAdWrapper::LookupExpr(const std::string &attr) const
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ExprTree * expr = Lookup(attr);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!expr)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_KeyError, attr.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ExprTreeHolder holder(expr);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::object result(holder);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+boost::python::object ClassAdWrapper::EvaluateAttrObject(const std::string &attr) const
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ExprTree *expr;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!(expr = Lookup(attr))) {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_KeyError, attr.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ExprTreeHolder holder(expr);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return holder.Evaluate();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void ClassAdWrapper::InsertAttrObject( const std::string &attr, boost::python::object value)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::extract<ExprTreeHolder&> expr_obj(value);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (expr_obj.check())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ExprTree *expr = expr_obj().get();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ Insert(attr, expr);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::extract<classad::Value::ValueType> value_enum_obj(value);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (value_enum_obj.check())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::Value::ValueType value_enum = value_enum_obj();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::Value classad_value;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (value_enum == classad::Value::ERROR_VALUE)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad_value.SetErrorValue();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ExprTree *lit = classad::Literal::MakeLiteral(classad_value);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ Insert(attr, lit);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else if (value_enum == classad::Value::UNDEFINED_VALUE)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad_value.SetUndefinedValue();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ExprTree *lit = classad::Literal::MakeLiteral(classad_value);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!Insert(attr, lit))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_AttributeError, attr.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (PyString_Check(value.ptr()))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string cppvalue = boost::python::extract<std::string>(value);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!InsertAttr(attr, cppvalue))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_AttributeError, attr.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (PyLong_Check(value.ptr()))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ long long cppvalue = boost::python::extract<long long>(value);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!InsertAttr(attr, cppvalue))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_AttributeError, attr.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (PyInt_Check(value.ptr()))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ long int cppvalue = boost::python::extract<long int>(value);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!InsertAttr(attr, cppvalue))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_AttributeError, attr.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (PyFloat_Check(value.ptr()))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ double cppvalue = boost::python::extract<double>(value);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!InsertAttr(attr, cppvalue))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_AttributeError, attr.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_TypeError, "Unknown ClassAd value type.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+std::string ClassAdWrapper::toRepr()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAdUnParser up;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string ad_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ up.Unparse(ad_str, this);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return ad_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+std::string ClassAdWrapper::toString()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::PrettyPrint pp;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string ad_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ pp.Unparse(ad_str, this);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return ad_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+std::string ClassAdWrapper::toOldString()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAdUnParser pp;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string ad_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ pp.SetOldClassAd(true);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ pp.Unparse(ad_str, this);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return ad_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+AttrKeyIter ClassAdWrapper::beginKeys()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return AttrKeyIter(begin());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+AttrKeyIter ClassAdWrapper::endKeys()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return AttrKeyIter(end());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+AttrValueIter ClassAdWrapper::beginValues()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return AttrValueIter(begin());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+AttrValueIter ClassAdWrapper::endValues()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return AttrValueIter(end());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+AttrItemIter ClassAdWrapper::beginItems()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return AttrItemIter(begin());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+AttrItemIter ClassAdWrapper::endItems()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return AttrItemIter(end());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ClassAdWrapper::ClassAdWrapper() : classad::ClassAd() {}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ClassAdWrapper::ClassAdWrapper(const std::string &str)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAdParser parser;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAd *result = parser.ParseClassAd(str);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!result)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_SyntaxError, "Unable to parse string into a ClassAd.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ CopyFrom(*result);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/classad_module.cpp b/src/condor_contrib/python-bindings/classad_module.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..b3f1970
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/classad_module.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,145 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <boost/python.hpp>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <classad/source.h>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "classad_wrapper.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "exprtree_wrapper.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+using namespace boost::python;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+Py_ssize_t py_len(boost::python::object const& obj)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ Py_ssize_t result = PyObject_Length(obj.ptr());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (PyErr_Occurred()) boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+std::string ClassadLibraryVersion()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string val;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAdLibraryVersion(val);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return val;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ClassAdWrapper *parseString(const std::string &str)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAdParser parser;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAd *result = parser.ParseClassAd(str);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!result)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_SyntaxError, "Unable to parse string into a ClassAd.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAdWrapper * wrapper_result = new ClassAdWrapper();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ wrapper_result->CopyFrom(*result);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ delete result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return wrapper_result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ClassAdWrapper *parseFile(FILE *stream)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAdParser parser;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAd *result = parser.ParseClassAd(stream);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!result)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_SyntaxError, "Unable to parse input stream into a ClassAd.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAdWrapper * wrapper_result = new ClassAdWrapper();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ wrapper_result->CopyFrom(*result);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ delete result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return wrapper_result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ClassAdWrapper *parseOld(object input)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAdWrapper * wrapper = new ClassAdWrapper();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object input_list;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ extract<std::string> input_extract(input);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (input_extract.check())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ input_list = input.attr("splitlines")();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ input_list = input.attr("readlines")();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ unsigned input_len = py_len(input_list);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for (unsigned idx=0; idx
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object line = input_list[idx].attr("strip")();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (line.attr("startswith")("#"))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ continue;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string line_str = extract<std::string>(line);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!wrapper->Insert(line_str))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_SyntaxError, line_str.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return wrapper;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void *convert_to_FILEptr(PyObject* obj) {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return PyFile_Check(obj) ? PyFile_AsFile(obj) : 0;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+BOOST_PYTHON_MODULE(classad)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ using namespace boost::python;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def("version", ClassadLibraryVersion, "Return the version of the linked ClassAd library.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def("parse", parseString, return_value_policy<manage_new_object>());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def("parse", parseFile, return_value_policy<manage_new_object>(),
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ "Parse input into a ClassAd.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param input: A string or a file pointer.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":return: A ClassAd object.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def("parseOld", parseOld, return_value_policy<manage_new_object>(),
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ "Parse old ClassAd format input into a ClassAd.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param input: A string or a file pointer.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":return: A ClassAd object.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ class_<ClassAdWrapper, boost::noncopyable>("ClassAd", "A classified advertisement.")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def(init<std::string>())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("__delitem__", &ClassAdWrapper::Delete)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("__getitem__", &ClassAdWrapper::LookupWrap)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("eval", &ClassAdWrapper::EvaluateAttrObject, "Evaluate the ClassAd attribute to a python object.")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("__setitem__", &ClassAdWrapper::InsertAttrObject)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("__str__", &ClassAdWrapper::toString)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("__repr__", &ClassAdWrapper::toRepr)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ // I see no way to use the SetParentScope interface safely.
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ // Delay exposing it to python until we absolutely have to!
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ //.def("setParentScope", &ClassAdWrapper::SetParentScope)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("__iter__", boost::python::range(&ClassAdWrapper::beginKeys, &ClassAdWrapper::endKeys))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("keys", boost::python::range(&ClassAdWrapper::beginKeys, &ClassAdWrapper::endKeys))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("values", boost::python::range(&ClassAdWrapper::beginValues, &ClassAdWrapper::endValues))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("items", boost::python::range(&ClassAdWrapper::beginItems, &ClassAdWrapper::endItems))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("__len__", &ClassAdWrapper::size)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("lookup", &ClassAdWrapper::LookupExpr, "Lookup an attribute and return a ClassAd expression. This method will not attempt to evaluate it to a python object.")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("printOld", &ClassAdWrapper::toOldString, "Represent this ClassAd as a string in the \"old ClassAd\" format.")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ class_<ExprTreeHolder>("ExprTree", "An expression in the ClassAd language", init<std::string>())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("__str__", &ExprTreeHolder::toString)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("__repr__", &ExprTreeHolder::toRepr)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("eval", &ExprTreeHolder::Evaluate)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ register_ptr_to_python< boost::shared_ptr<ClassAdWrapper> >();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::enum_<classad::Value::ValueType>("Value")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Error", classad::Value::ERROR_VALUE)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Undefined", classad::Value::UNDEFINED_VALUE)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::converter::registry::insert(convert_to_FILEptr,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::type_id<FILE>());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/classad_wrapper.h b/src/condor_contrib/python-bindings/classad_wrapper.h
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..96600c3
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/classad_wrapper.h
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,72 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#ifndef __CLASSAD_WRAPPER_H_
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#define __CLASSAD_WRAPPER_H_
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <classad/classad.h>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <boost/python.hpp>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <boost/iterator/transform_iterator.hpp>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+struct AttrPairToFirst :
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ public std::unary_function<std::pair<std::string, classad::ExprTree*> const&, std::string>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ AttrPairToFirst::result_type operator()(AttrPairToFirst::argument_type p) const
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return p.first;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+};
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+typedef boost::transform_iterator<AttrPairToFirst, classad::AttrList::iterator> AttrKeyIter;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+class ExprTreeHolder;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+struct AttrPairToSecond :
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ public std::unary_function<std::pair<std::string, classad::ExprTree*> const&, boost::python::object>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ AttrPairToSecond::result_type operator()(AttrPairToSecond::argument_type p) const;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+};
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+typedef boost::transform_iterator<AttrPairToSecond, classad::AttrList::iterator> AttrValueIter;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+struct AttrPair :
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ public std::unary_function<std::pair<std::string, classad::ExprTree*> const&, boost::python::object>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ AttrPair::result_type operator()(AttrPair::argument_type p) const;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+};
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+typedef boost::transform_iterator<AttrPair, classad::AttrList::iterator> AttrItemIter;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+struct ClassAdWrapper : classad::ClassAd, boost::python::wrapper<classad::ClassAd>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::object LookupWrap( const std::string &attr) const;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::object EvaluateAttrObject(const std::string &attr) const;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ void InsertAttrObject( const std::string &attr, boost::python::object value);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::object LookupExpr(const std::string &attr) const;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string toRepr();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string toString();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string toOldString();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ AttrKeyIter beginKeys();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ AttrKeyIter endKeys();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ AttrValueIter beginValues();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ AttrValueIter endValues();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ AttrItemIter beginItems();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ AttrItemIter endItems();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAdWrapper();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAdWrapper(const std::string &str);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+};
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#endif
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/collector.cpp b/src/condor_contrib/python-bindings/collector.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..3c4fa39
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/collector.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,329 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_adtypes.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "dc_collector.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_version.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <memory>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <boost/python.hpp>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "old_boost.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "classad_wrapper.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+using namespace boost::python;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+AdTypes convert_to_ad_type(daemon_t d_type)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ AdTypes ad_type = NO_AD;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ switch (d_type)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case DT_MASTER:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad_type = MASTER_AD;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case DT_STARTD:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad_type = STARTD_AD;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case DT_SCHEDD:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad_type = SCHEDD_AD;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case DT_NEGOTIATOR:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad_type = NEGOTIATOR_AD;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case DT_COLLECTOR:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad_type = COLLECTOR_AD;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ default:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, "Unknown daemon type.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return ad_type;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+struct Collector {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ Collector(const std::string &pool="")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ : m_collectors(NULL)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (pool.size())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ m_collectors = CollectorList::create(pool.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ m_collectors = CollectorList::create();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ~Collector()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (m_collectors) delete m_collectors;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object query(AdTypes ad_type, const std::string &constraint, list attrs)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ CondorQuery query(ad_type);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (constraint.length())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ query.addANDConstraint(constraint.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::vector<const char *> attrs_char;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::vector<std::string> attrs_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int len_attrs = py_len(attrs);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (len_attrs)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ attrs_str.reserve(len_attrs);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ attrs_char.reserve(len_attrs+1);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ attrs_char[len_attrs] = NULL;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for (int i=0; i
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string str = extract<std::string>(attrs[i]);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ attrs_str.push_back(str);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ attrs_char[i] = attrs_str[i].c_str();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ query.setDesiredAttrs(&attrs_char[0]);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAdList adList;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ QueryResult result = m_collectors->query(query, adList, NULL);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ switch (result)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case Q_OK:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case Q_INVALID_CATEGORY:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Category not supported by query type.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case Q_MEMORY_ERROR:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_MemoryError, "Memory allocation error.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case Q_PARSE_ERROR:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_SyntaxError, "Query constraints could not be parsed.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case Q_COMMUNICATION_ERROR:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_IOError, "Failed communication with collector.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case Q_INVALID_QUERY:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Invalid query.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case Q_NO_COLLECTOR_HOST:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to determine collector host.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ default:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unknown error from collector query.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ list retval;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAd * ad;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ adList.Open();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ while ((ad = adList.Next()))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::shared_ptr<ClassAdWrapper> wrapper(new ClassAdWrapper());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ wrapper->CopyFrom(*ad);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ retval.append(wrapper);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return retval;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object locateAll(daemon_t d_type)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ AdTypes ad_type = convert_to_ad_type(d_type);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return query(ad_type, "", list());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object locate(daemon_t d_type, const std::string &name)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string constraint = ATTR_NAME " =?= \"" + name + "\"";
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object result = query(convert_to_ad_type(d_type), constraint, list());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (py_len(result) >= 1) {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return result[0];
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, "Unable to find daemon.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return object();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAdWrapper *locateLocal(daemon_t d_type)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ Daemon my_daemon( d_type, 0, 0 );
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAdWrapper *wrapper = new ClassAdWrapper();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (my_daemon.locate())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAd *daemonAd;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if ((daemonAd = my_daemon.daemonAd()))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ wrapper->CopyFrom(*daemonAd);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string addr = my_daemon.addr();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!my_daemon.addr() || !wrapper->InsertAttr(ATTR_MY_ADDRESS, addr))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to locate daemon address.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string name = my_daemon.name() ? my_daemon.name() : "Unknown";
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!wrapper->InsertAttr(ATTR_NAME, name))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to insert daemon name.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string hostname = my_daemon.fullHostname() ? my_daemon.fullHostname() : "Unknown";
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!wrapper->InsertAttr(ATTR_MACHINE, hostname))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to insert daemon hostname.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string version = my_daemon.version() ? my_daemon.version() : "";
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!wrapper->InsertAttr(ATTR_VERSION, version))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to insert daemon version.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ const char * my_type = AdTypeToString(convert_to_ad_type(d_type));
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!my_type)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, "Unable to determined daemon type.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string my_type_str = my_type;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!wrapper->InsertAttr(ATTR_MY_TYPE, my_type_str))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to insert daemon type.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string cversion = CondorVersion(); std::string platform = CondorPlatform();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!wrapper->InsertAttr(ATTR_VERSION, cversion) || !wrapper->InsertAttr(ATTR_PLATFORM, platform))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to insert HTCondor version.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to locate local daemon");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return wrapper;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ // Overloads for the Collector; can't be done in boost.python and provide
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ // docstrings.
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object query0()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return query(ANY_AD, "", list());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object query1(AdTypes ad_type)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return query(ad_type, "", list());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object query2(AdTypes ad_type, const std::string &constraint)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return query(ad_type, constraint, list());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ // TODO: this has crappy error handling when there are multiple collectors.
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ void advertise(list ads, const std::string &command_str="UPDATE_AD_GENERIC", bool use_tcp=false)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ m_collectors->rewind();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ Daemon *collector;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::auto_ptr<Sock> sock;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int command = getCollectorCommandNum(command_str.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (command == -1)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, ("Invalid command " + command_str).c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (command == UPDATE_STARTD_AD_WITH_ACK)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_NotImplementedError, "Startd-with-ack protocol is not implemented at this time.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int list_len = py_len(ads);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!list_len)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ compat_classad::ClassAd ad;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ while (m_collectors->next(collector))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if(!collector->locate()) {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, "Unable to locate collector.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int list_len = py_len(ads);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ sock.reset();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for (int i=0; i
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAdWrapper &wrapper = extract<ClassAdWrapper &>(ads[i]);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad.CopyFrom(wrapper);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (use_tcp)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!sock.get())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ sock.reset(collector->startCommand(command,Stream::reli_sock,20));
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ sock->encode();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ sock->put(command);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ sock.reset(collector->startCommand(command,Stream::safe_sock,20));
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int result = 0;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (sock.get()) {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result += ad.put(*sock);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result += sock->end_of_message();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (result != 2) {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, "Failed to advertise to collector");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ sock->encode();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ sock->put(DC_NOP);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ sock->end_of_message();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+private:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ CollectorList *m_collectors;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+};
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(advertise_overloads, advertise, 1, 3);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void export_collector()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ class_<Collector>("Collector", "Client-side operations for the HTCondor collector")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def(init<std::string>(":param pool: Name of collector to query; if not specified, uses the local one."))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("query", &Collector::query0)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("query", &Collector::query1)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("query", &Collector::query2)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("query", &Collector::query,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ "Query the contents of a collector.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param ad_type: Type of ad to return from the AdTypes enum; if not specified, uses ANY_AD.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param constraint: A constraint for the ad query; defaults to true.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param attrs: A list of attributes; if specified, the returned ads will be "
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ "projected along these attributes.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":return: A list of ads in the collector matching the constraint.")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("locate", &Collector::locateLocal, return_value_policy<manage_new_object>())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("locate", &Collector::locate,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ "Query the collector for a particular daemon.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param daemon_type: Type of daemon; must be from the DaemonTypes enum.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param name: Name of daemon to locate. If not specified, it searches for the local daemon.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":return: The ad of the corresponding daemon.")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("locateAll", &Collector::locateAll,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ "Query the collector for all ads of a particular type.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param daemon_type: Type of daemon; must be from the DaemonTypes enum.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":return: A list of matching ads.")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("advertise", &Collector::advertise, advertise_overloads(
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ "Advertise a list of ClassAds into the collector.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param ad_list: A list of ClassAds.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param command: A command for the collector; defaults to UPDATE_AD_GENERIC;"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ " other commands, such as UPDATE_STARTD_AD, may require reduced authorization levels.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param use_tcp: When set to true, updates are sent via TCP."))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/condor.cpp b/src/condor_contrib/python-bindings/condor.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..f4a4fd4
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/condor.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,25 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <boost/python.hpp>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "old_boost.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "export_headers.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+using namespace boost::python;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+BOOST_PYTHON_MODULE(condor)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ scope().attr("__doc__") = "Utilities for interacting with the HTCondor system.";
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ py_import("classad");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ // TODO: old boost doesn't have this; conditionally compile only one newer systems.
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ //docstring_options local_docstring_options(true, false, false);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ export_config();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ export_daemon_and_ad_types();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ export_collector();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ export_schedd();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ export_dc_tool();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ export_secman();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/config.cpp b/src/condor_contrib/python-bindings/config.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..0afdfc4
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/config.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,60 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_common.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_config.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_version.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <boost/python.hpp>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+using namespace boost::python;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+struct Param
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string getitem(const std::string &attr)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!param(result, attr.c_str()))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_KeyError, attr.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ void setitem(const std::string &attr, const std::string &val)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ param_insert(attr.c_str(), val.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string setdefault(const std::string &attr, const std::string &def)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!param(result, attr.c_str()))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ param_insert(attr.c_str(), def.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return def;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+};
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+std::string CondorVersionWrapper() { return CondorVersion(); }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+std::string CondorPlatformWrapper() { return CondorPlatform(); }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+BOOST_PYTHON_FUNCTION_OVERLOADS(config_overloads, config, 0, 3);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void export_config()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ config();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def("version", CondorVersionWrapper, "Returns the version of HTCondor this module is linked against.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def("platform", CondorPlatformWrapper, "Returns the platform of HTCondor this module is running on.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def("reload_config", config, config_overloads("Reload the HTCondor configuration from disk."));
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ class_<Param>("_Param")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("__getitem__", &Param::getitem)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("__setitem__", &Param::setitem)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("setdefault", &Param::setdefault)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object param = object(Param());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ param.attr("__doc__") = "A dictionary-like object containing the HTCondor configuration.";
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ scope().attr("param") = param;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/daemon_and_ad_types.cpp b/src/condor_contrib/python-bindings/daemon_and_ad_types.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..f2b0bab
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/daemon_and_ad_types.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,30 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <condor_adtypes.h>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <daemon_types.h>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <boost/python.hpp>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+using namespace boost::python;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void export_daemon_and_ad_types()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ enum_<daemon_t>("DaemonTypes")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("None", DT_NONE)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Any", DT_ANY)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Master", DT_MASTER)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Schedd", DT_SCHEDD)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Startd", DT_STARTD)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Collector", DT_COLLECTOR)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Negotiator", DT_NEGOTIATOR)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ enum_<AdTypes>("AdTypes")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("None", NO_AD)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Any", ANY_AD)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Generic", GENERIC_AD)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Startd", STARTD_AD)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Schedd", SCHEDD_AD)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Master", MASTER_AD)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Collector", COLLECTOR_AD)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Negotiator", NEGOTIATOR_AD)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/dc_tool.cpp b/src/condor_contrib/python-bindings/dc_tool.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..973c1e3
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/dc_tool.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,129 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_common.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <boost/python.hpp>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "daemon.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "daemon_types.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_commands.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_attributes.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "compat_classad.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "classad_wrapper.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+using namespace boost::python;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+enum DaemonCommands {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DDAEMONS_OFF = DAEMONS_OFF,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DDAEMONS_OFF_FAST = DAEMONS_OFF_FAST,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DDAEMONS_OFF_PEACEFUL = DAEMONS_OFF_PEACEFUL,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DDAEMON_OFF = DAEMON_OFF,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DDAEMON_OFF_FAST = DAEMON_OFF_FAST,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DDAEMON_OFF_PEACEFUL = DAEMON_OFF_PEACEFUL,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DDC_OFF_FAST = DC_OFF_FAST,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DDC_OFF_PEACEFUL = DC_OFF_PEACEFUL,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DDC_OFF_GRACEFUL = DC_OFF_GRACEFUL,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DDC_SET_PEACEFUL_SHUTDOWN = DC_SET_PEACEFUL_SHUTDOWN,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DDC_RECONFIG_FULL = DC_RECONFIG_FULL,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DRESTART = RESTART,
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DRESTART_PEACEFUL = RESTART_PEACEFUL
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+};
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void send_command(const ClassAdWrapper & ad, DaemonCommands dc, const std::string &target="")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string addr;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!ad.EvaluateAttrString(ATTR_MY_ADDRESS, addr))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, "Address not available in location ClassAd.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string ad_type_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!ad.EvaluateAttrString(ATTR_MY_TYPE, ad_type_str))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, "Daemon type not available in location ClassAd.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int ad_type = AdTypeFromString(ad_type_str.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (ad_type == NO_AD)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ printf("ad type %s.\n", ad_type_str.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, "Unknown ad type.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ daemon_t d_type;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ switch (ad_type) {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case MASTER_AD: d_type = DT_MASTER; break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case STARTD_AD: d_type = DT_STARTD; break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case SCHEDD_AD: d_type = DT_SCHEDD; break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case NEGOTIATOR_AD: d_type = DT_NEGOTIATOR; break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case COLLECTOR_AD: d_type = DT_COLLECTOR; break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ default:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ d_type = DT_NONE;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, "Unknown daemon type.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAd ad_copy; ad_copy.CopyFrom(ad);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ Daemon d(&ad_copy, d_type, NULL);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!d.locate())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to locate daemon.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ReliSock sock;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!sock.connect(d.addr()))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to connect to the remote daemon");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!d.startCommand(dc, &sock, 0, NULL))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Failed to start command.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (target.size())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::vector<unsigned char> target_cstr; target_cstr.reserve(target.size()+1);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ memcpy(&target_cstr[0], target.c_str(), target.size()+1);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!sock.code(&target_cstr[0]))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Failed to send target.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!sock.end_of_message())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Failed to send end-of-message.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ sock.close();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+BOOST_PYTHON_FUNCTION_OVERLOADS(send_command_overloads, send_command, 2, 3);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+export_dc_tool()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ enum_<DaemonCommands>("DaemonCommands")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("DaemonsOff", DDAEMONS_OFF)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("DaemonsOffFast", DDAEMONS_OFF_FAST)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("DaemonsOffPeaceful", DDAEMONS_OFF_PEACEFUL)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("DaemonOff", DDAEMON_OFF)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("DaemonOffFast", DDAEMON_OFF_FAST)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("DaemonOffPeaceful", DDAEMON_OFF_PEACEFUL)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("OffGraceful", DDC_OFF_GRACEFUL)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("OffPeaceful", DDC_OFF_PEACEFUL)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("OffFast", DDC_OFF_FAST)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("SetPeacefulShutdown", DDC_SET_PEACEFUL_SHUTDOWN)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Reconfig", DDC_RECONFIG_FULL)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Restart", DRESTART)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("RestartPeacful", DRESTART_PEACEFUL)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def("send_command", send_command, send_command_overloads("Send a command to a HTCondor daemon specified by a location ClassAd\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param ad: An ad specifying the location of the daemon; typically, found by using Collector.locate(...).\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param dc: A command type; must be a member of the enum DaemonCommands.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param target: Some commands require additional arguments; for example, sending DaemonOff to a master requires one to specify which subsystem to turn off."
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ " If this parameter is given, the daemon is sent an additional argument."))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/export_headers.h b/src/condor_contrib/python-bindings/export_headers.h
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..4480495
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/export_headers.h
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,8 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void export_collector();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void export_schedd();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void export_dc_tool();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void export_daemon_and_ad_types();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void export_config();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void export_secman();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/exprtree_wrapper.h b/src/condor_contrib/python-bindings/exprtree_wrapper.h
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..e3d2bc0
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/exprtree_wrapper.h
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,30 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#ifndef __EXPRTREE_WRAPPER_H_
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#define __EXPRTREE_WRAPPER_H_
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <classad/exprTree.h>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <boost/python.hpp>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+struct ExprTreeHolder
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ExprTreeHolder(const std::string &str);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ExprTreeHolder(classad::ExprTree *expr);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ~ExprTreeHolder();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::object Evaluate() const;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string toRepr();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string toString();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ExprTree *get();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+private:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ExprTree *m_expr;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ bool m_owns;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+};
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#endif
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/old_boost.h b/src/condor_contrib/python-bindings/old_boost.h
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..7d159bc
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/old_boost.h
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,25 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <boost/python.hpp>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+/*
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ * This header contains all boost.python constructs missing in
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ * older versions of boost.
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ *
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ * We'll eventually not compile these if the version of boost
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ * is sufficiently recent.
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ */
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+inline ssize_t py_len(boost::python::object const& obj)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ssize_t result = PyObject_Length(obj.ptr());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (PyErr_Occurred()) boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return result;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+inline boost::python::object py_import(boost::python::str name)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ char * n = boost::python::extract<char *>(name);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::handle<> module(PyImport_ImportModule(n));
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return boost::python::object(module);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/schedd.cpp b/src/condor_contrib/python-bindings/schedd.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..9bbc830
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/schedd.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,402 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_attributes.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_q.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_qmgr.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "daemon.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "daemon_types.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "enum_utils.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "dc_schedd.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <boost/python.hpp>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "old_boost.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "classad_wrapper.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "exprtree_wrapper.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+using namespace boost::python;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#define DO_ACTION(action_name) \
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ reason_str = extract<std::string>(reason); \
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (use_ids) \
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = schedd. action_name (&ids, reason_str.c_str(), NULL, AR_TOTALS); \
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else \
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = schedd. action_name (constraint.c_str(), reason_str.c_str(), NULL, AR_TOTALS);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+struct Schedd {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ Schedd()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ Daemon schedd( DT_SCHEDD, 0, 0 );
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (schedd.locate())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (schedd.addr())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ m_addr = schedd.addr();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to locate schedd address.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ m_name = schedd.name() ? schedd.name() : "Unknown";
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ m_version = schedd.version() ? schedd.version() : "";
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to locate local daemon");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::python::throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ Schedd(const ClassAdWrapper &ad)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ : m_addr(), m_name("Unknown"), m_version("")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!ad.EvaluateAttrString(ATTR_SCHEDD_IP_ADDR, m_addr))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, "Schedd address not specified.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad.EvaluateAttrString(ATTR_NAME, m_name);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad.EvaluateAttrString(ATTR_VERSION, m_version);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object query(const std::string &constraint="", list attrs=list())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ CondorQ q;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (constraint.size())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ q.addAND(constraint.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ StringList attrs_list(NULL, "\n");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ // Must keep strings alive; StringList does not create an internal copy.
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int len_attrs = py_len(attrs);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::vector<std::string> attrs_str; attrs_str.reserve(len_attrs);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for (int i=0; i
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string attrName = extract<std::string>(attrs[i]);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ attrs_str.push_back(attrName);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ attrs_list.append(attrs_str[i].c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAdList jobs;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int fetchResult = q.fetchQueueFromHost(jobs, attrs_list, m_addr.c_str(), m_version.c_str(), NULL);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ switch (fetchResult)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case Q_OK:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case Q_PARSE_ERROR:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case Q_INVALID_CATEGORY:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Parse error in constraint.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ default:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_IOError, "Failed to fetch ads from schedd.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ list retval;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAd *job;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ jobs.Open();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ while ((job = jobs.Next()))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::shared_ptr<ClassAdWrapper> wrapper(new ClassAdWrapper());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ wrapper->CopyFrom(*job);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ retval.append(wrapper);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return retval;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object actOnJobs(JobAction action, object job_spec, object reason=object())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (reason == object())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ reason = object("Python-initiated action");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ StringList ids;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::vector<std::string> ids_list;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string constraint, reason_str, reason_code;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ bool use_ids = false;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ extract<std::string> constraint_extract(job_spec);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (constraint_extract.check())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ constraint = constraint_extract();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int id_len = py_len(job_spec);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ids_list.reserve(id_len);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for (int i=0; i
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string str = extract<std::string>(job_spec[i]);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ids_list.push_back(str);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ids.append(ids_list[i].c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ use_ids = true;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DCSchedd schedd(m_addr.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAd *result = NULL;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ VacateType vacate_type;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ tuple reason_tuple;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ const char *reason_char, *reason_code_char = NULL;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ extract<tuple> try_extract_tuple(reason);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ switch (action)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case JA_HOLD_JOBS:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (try_extract_tuple.check())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ reason_tuple = extract<tuple>(reason);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (py_len(reason_tuple) != 2)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, "Hold action requires (hold string, hold code) tuple as the reason.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ reason_str = extract<std::string>(reason_tuple[0]); reason_char = reason_str.c_str();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ reason_code = extract<std::string>(reason_tuple[1]); reason_code_char = reason_code.c_str();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ reason_str = extract<std::string>(reason);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ reason_char = reason_str.c_str();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (use_ids)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = schedd.holdJobs(&ids, reason_char, reason_code_char, NULL, AR_TOTALS);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = schedd.holdJobs(constraint.c_str(), reason_char, reason_code_char, NULL, AR_TOTALS);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case JA_RELEASE_JOBS:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DO_ACTION(releaseJobs)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case JA_REMOVE_JOBS:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DO_ACTION(removeJobs)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case JA_REMOVE_X_JOBS:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DO_ACTION(removeXJobs)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case JA_VACATE_JOBS:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case JA_VACATE_FAST_JOBS:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ vacate_type = action == JA_VACATE_JOBS ? VACATE_GRACEFUL : VACATE_FAST;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (use_ids)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = schedd.vacateJobs(&ids, vacate_type, NULL, AR_TOTALS);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result = schedd.vacateJobs(constraint.c_str(), vacate_type, NULL, AR_TOTALS);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case JA_SUSPEND_JOBS:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DO_ACTION(suspendJobs)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ case JA_CONTINUE_JOBS:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ DO_ACTION(continueJobs)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ break;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ default:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_NotImplementedError, "Job action not implemented.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (!result)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Error when querying the schedd.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::shared_ptr<ClassAdWrapper> wrapper(new ClassAdWrapper());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ wrapper->CopyFrom(*result);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object wrapper_obj(wrapper);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ boost::shared_ptr<ClassAdWrapper> result_ptr(new ClassAdWrapper());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object result_obj(result_ptr);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result_obj["TotalError"] = wrapper_obj["result_total_0"];
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result_obj["TotalSuccess"] = wrapper_obj["result_total_1"];
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result_obj["TotalNotFound"] = wrapper_obj["result_total_2"];
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result_obj["TotalBadStatus"] = wrapper_obj["result_total_3"];
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result_obj["TotalAlreadyDone"] = wrapper_obj["result_total_4"];
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result_obj["TotalPermissionDenied"] = wrapper_obj["result_total_5"];
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result_obj["TotalJobAds"] = wrapper_obj["TotalJobAds"];
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ result_obj["TotalChangedAds"] = wrapper_obj["ActionResult"];
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return result_obj;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object actOnJobs2(JobAction action, object job_spec)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return actOnJobs(action, job_spec, object("Python-initiated action."));
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int submit(ClassAdWrapper &wrapper, int count=1)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ConnectionSentry sentry(*this); // Automatically connects / disconnects.
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int cluster = NewCluster();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (cluster < 0)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Failed to create new cluster.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ClassAd ad; ad.CopyFrom(wrapper);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for (int idx=0; idx
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int procid = NewProc (cluster);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (procid < 0)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Failed to create new proc id.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad.InsertAttr(ATTR_CLUSTER_ID, cluster);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad.InsertAttr(ATTR_PROC_ID, procid);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAdUnParser unparser;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ unparser.SetOldClassAd( true );
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for (classad::ClassAd::const_iterator it = ad.begin(); it != ad.end(); it++)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string rhs;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ unparser.Unparse(rhs, it->second);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (-1 == SetAttribute(cluster, procid, it->first.c_str(), rhs.c_str(), SetAttribute_NoAck))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, it->first.c_str());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return cluster;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ void edit(object job_spec, std::string attr, object val)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::vector<int> clusters;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::vector<int> procs;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string constraint;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ bool use_ids = false;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ extract<std::string> constraint_extract(job_spec);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (constraint_extract.check())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ constraint = constraint_extract();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ int id_len = py_len(job_spec);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ clusters.reserve(id_len);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ procs.reserve(id_len);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for (int i=0; i
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ object id_list = job_spec[i].attr("split")(".");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (py_len(id_list) != 2)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_ValueError, "Invalid ID");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ clusters.push_back(extract<int>(long_(id_list[0])));
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ procs.push_back(extract<int>(long_(id_list[1])));
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ use_ids = true;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string val_str;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ extract<ExprTreeHolder &> exprtree_extract(val);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (exprtree_extract.check())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ classad::ClassAdUnParser unparser;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ unparser.Unparse(val_str, exprtree_extract().get());
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ val_str = extract<std::string>(val);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ConnectionSentry sentry(*this);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (use_ids)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for (unsigned idx=0; idx
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (-1 == SetAttribute(clusters[idx], procs[idx], attr.c_str(), val_str.c_str()))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to edit job");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (-1 == SetAttributeByConstraint(constraint.c_str(), attr.c_str(), val_str.c_str()))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Unable to edit jobs matching constraint");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+private:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ struct ConnectionSentry
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ public:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ConnectionSentry(Schedd &schedd) : m_connected(false)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (ConnectQ(schedd.m_addr.c_str(), 0, false, NULL, NULL, schedd.m_version.c_str()) == 0)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Failed to connect to schedd.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ m_connected = true;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ void disconnect()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if (m_connected && !DisconnectQ(NULL))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ m_connected = false;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ PyErr_SetString(PyExc_RuntimeError, "Failed to commmit and disconnect from queue.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ throw_error_already_set();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ m_connected = false;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ~ConnectionSentry()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ disconnect();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ private:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ bool m_connected;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ };
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ std::string m_addr, m_name, m_version;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+};
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(query_overloads, query, 0, 2);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(submit_overloads, submit, 1, 2);
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void export_schedd()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ enum_<JobAction>("JobAction")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Hold", JA_HOLD_JOBS)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Release", JA_RELEASE_JOBS)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Remove", JA_REMOVE_JOBS)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("RemoveX", JA_REMOVE_X_JOBS)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Vacate", JA_VACATE_JOBS)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("VacateFast", JA_VACATE_FAST_JOBS)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Suspend", JA_SUSPEND_JOBS)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .value("Continue", JA_CONTINUE_JOBS)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ class_<Schedd>("Schedd", "A client class for the HTCondor schedd")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def(init<const ClassAdWrapper &>(":param ad: An ad containing the location of the schedd"))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("query", &Schedd::query, query_overloads("Query the HTCondor schedd for jobs.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param constraint: An optional constraint for filtering out jobs; defaults to 'true'\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param attr_list: A list of attributes for the schedd to project along. Defaults to having the schedd return all attributes.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":return: A list of matching jobs, containing the requested attributes."))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("act", &Schedd::actOnJobs2)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("act", &Schedd::actOnJobs, "Change status of job(s) in the schedd.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param action: Action to perform; must be from enum JobAction.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param job_spec: Job specification; can either be a list of job IDs or a string specifying a constraint to match jobs.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":return: Number of jobs changed.")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("submit", &Schedd::submit, submit_overloads("Submit one or more jobs to the HTCondor schedd.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param ad: ClassAd describing job cluster.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param count: Number of jobs to submit to cluster.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":return: Newly created cluster ID."))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("edit", &Schedd::edit, "Edit one or more jobs in the queue.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param job_spec: Either a list of jobs (CLUSTER.PROC) or a string containing a constraint to match jobs against.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param attr: Attribute name to edit.\n"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ":param value: The new value of the job attribute; should be a string (which will be converted to a ClassAds expression) or a ClassAds expression.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/secman.cpp b/src/condor_contrib/python-bindings/secman.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..343fba8
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/secman.cpp
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,35 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_common.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include <boost/python.hpp>
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+// Note - condor_secman.h can't be included directly. The following headers must
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+// be loaded first. Sigh.
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_ipverify.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "sock.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#include "condor_secman.h"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+using namespace boost::python;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+struct SecManWrapper
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+public:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ SecManWrapper() : m_secman() {}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ void
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ invalidateAllCache()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ {
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ m_secman.invalidateAllCache();
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ }
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+private:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ SecMan m_secman;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+};
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+void
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+export_secman()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+{
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ class_<SecManWrapper>("SecMan", "Access to the internal security state information.")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ .def("invalidateAllSessions", &SecManWrapper::invalidateAllCache, "Invalidate all security sessions.");
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+}
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/tests/classad_tests.py b/src/condor_contrib/python-bindings/tests/classad_tests.py
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..7641190
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/tests/classad_tests.py
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,79 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#!/usr/bin/python
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+import re
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+import classad
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+import unittest
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+class TestClassad(unittest.TestCase):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_load_classad_from_file(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad = classad.parse(open("tests/test.ad"))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(ad["foo"], "bar")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(ad["baz"], classad.Value.Undefined)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertRaises(KeyError, ad.__getitem__, "bar")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_old_classad(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad = classad.parseOld(open("tests/test.old.ad"))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ contents = open("tests/test.old.ad").read()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(ad.printOld(), contents)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_exprtree(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad = classad.ClassAd()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["foo"] = classad.ExprTree("2+2")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ expr = ad["foo"]
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(expr.__repr__(), "2 + 2")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(expr.eval(), 4)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_exprtree_func(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad = classad.ClassAd()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["foo"] = classad.ExprTree('regexps("foo (bar)", "foo bar", "\\\\1")')
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(ad.eval("foo"), "bar")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_ad_assignment(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad = classad.ClassAd()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["foo"] = 2.1
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(ad["foo"], 2.1)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["foo"] = 2
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(ad["foo"], 2)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["foo"] = "bar"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(ad["foo"], "bar")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertRaises(TypeError, ad.__setitem__, {})
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_ad_refs(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad = classad.ClassAd()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["foo"] = classad.ExprTree("bar + baz")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["bar"] = 2.1
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["baz"] = 4
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(ad["foo"].__repr__(), "bar + baz")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(ad.eval("foo"), 6.1)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_ad_special_values(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad = classad.ClassAd()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["foo"] = classad.ExprTree('regexp(12, 34)')
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["bar"] = classad.Value.Undefined
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(ad["foo"].eval(), classad.Value.Error)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertNotEqual(ad["foo"].eval(), ad["bar"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(classad.Value.Undefined, ad["bar"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_ad_iterator(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad = classad.ClassAd()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["foo"] = 1
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["bar"] = 2
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(len(ad), 2)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(len(list(ad)), 2)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(list(ad)[1], "foo")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(list(ad)[0], "bar")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(list(ad.items())[1][1], 1)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(list(ad.items())[0][1], 2)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(list(ad.values())[1], 1)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEqual(list(ad.values())[0], 2)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_ad_lookup(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad = classad.ClassAd()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad["foo"] = classad.Value.Error
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertTrue(isinstance(ad.lookup("foo"), classad.ExprTree))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEquals(ad.lookup("foo").eval(), classad.Value.Error)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+if __name__ == '__main__':
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ unittest.main()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/tests/condor_tests.py b/src/condor_contrib/python-bindings/tests/condor_tests.py
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..2293fc2
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/tests/condor_tests.py
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,173 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+#!/usr/bin/python
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+import os
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+import re
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+import time
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+import condor
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+import errno
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+import signal
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+import classad
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+import unittest
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+class TestConfig(unittest.TestCase):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def setUp(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.environ["_condor_FOO"] = "BAR"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ condor.reload_config()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_config(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEquals(condor.param["FOO"], "BAR")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_reconfig(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ condor.param["FOO"] = "BAZ"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEquals(condor.param["FOO"], "BAZ")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.environ["_condor_FOO"] = "1"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ condor.reload_config()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEquals(condor.param["FOO"], "1")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+class TestVersion(unittest.TestCase):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def setUp(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ fd = os.popen("condor_version")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.lines = []
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for line in fd.readlines():
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.lines.append(line.strip())
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if fd.close():
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ raise RuntimeError("Unable to invoke condor_version")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_version(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEquals(condor.version(), self.lines[0])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def test_platform(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEquals(condor.platform(), self.lines[1])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+def makedirs_ignore_exist(directory):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ try:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.makedirs(directory)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ except OSError, oe:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if oe.errno != errno.EEXIST:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ raise
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+def remove_ignore_missing(file):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ try:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.unlink(file)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ except OSError, oe:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if oe.errno != errno.ENOENT:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ raise
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+class TestWithDaemons(unittest.TestCase):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def setUp(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.pid = -1
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ testdir = os.path.join(os.getcwd(), "tests_tmp")
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ makedirs_ignore_exist(testdir)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.environ["_condor_LOCAL_DIR"] = testdir
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.environ["_condor_LOG"] = '$(LOCAL_DIR)/log'
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.environ["_condor_LOCK"] = '$(LOCAL_DIR)/lock'
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.environ["_condor_RUN"] = '$(LOCAL_DIR)/run'
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.environ["_condor_COLLECTOR_NAME"] = "python_classad_tests"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.environ["_condor_SCHEDD_NAME"] = "python_classad_tests"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ condor.reload_config()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ condor.SecMan().invalidateAllSessions()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def launch_daemons(self, daemons=["MASTER", "COLLECTOR"]):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ makedirs_ignore_exist(condor.param["LOG"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ makedirs_ignore_exist(condor.param["LOCK"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ makedirs_ignore_exist(condor.param["EXECUTE"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ makedirs_ignore_exist(condor.param["SPOOL"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ makedirs_ignore_exist(condor.param["RUN"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ remove_ignore_missing(condor.param["MASTER_ADDRESS_FILE"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ remove_ignore_missing(condor.param["COLLECTOR_ADDRESS_FILE"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ remove_ignore_missing(condor.param["SCHEDD_ADDRESS_FILE"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if "COLLECTOR" in daemons:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.environ["_condor_PORT"] = "9622"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.environ["_condor_COLLECTOR_ARGS"] = "-port $(PORT)"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.environ["_condor_COLLECTOR_HOST"] = "$(CONDOR_HOST):$(PORT)"
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if 'MASTER' not in daemons:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ daemons.append('MASTER')
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.environ["_condor_DAEMON_LIST"] = ", ".join(daemons)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ condor.reload_config()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.pid = os.fork()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if not self.pid:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ try:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ try:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.execvp("condor_master", ["condor_master", "-f"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ except Exception, e:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ print str(e)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ finally:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os._exit(1)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for daemon in daemons:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.waitLocalDaemon(daemon)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def tearDown(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if self.pid > 1:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ os.kill(self.pid, signal.SIGQUIT)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ pid, exit_status = os.waitpid(self.pid, 0)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertTrue(os.WIFEXITED(exit_status))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ code = os.WEXITSTATUS(exit_status)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEquals(code, 0)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def waitLocalDaemon(self, daemon, timeout=5):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ address_file = condor.param[daemon + "_ADDRESS_FILE"]
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for i in range(timeout):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if os.path.exists(address_file):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ time.sleep(1)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if not os.path.exists(address_file):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ raise RuntimeError("Waiting for daemon %s timed out." % daemon)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def waitRemoteDaemon(self, dtype, dname, pool=None, timeout=5):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if pool:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ coll = condor.Collector(pool)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ else:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ coll = condor.Collector()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for i in range(timeout):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ try:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return coll.locate(dtype, dname)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ except Exception:
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ pass
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ time.sleep(1)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ return coll.locate(dtype, dname)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def testDaemon(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.launch_daemons(["COLLECTOR"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def testLocate(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.launch_daemons(["COLLECTOR"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ coll = condor.Collector()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ coll_ad = coll.locate(condor.DaemonTypes.Collector)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertTrue("MyAddress" in coll_ad)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEquals(coll_ad["Name"].split(":")[-1], os.environ["_condor_PORT"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def testRemoteLocate(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.launch_daemons(["COLLECTOR"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ coll = condor.Collector()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ coll_ad = coll.locate(condor.DaemonTypes.Collector)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ remote_ad = self.waitRemoteDaemon(condor.DaemonTypes.Collector, "%s@%s" % (condor.param["COLLECTOR_NAME"], condor.param["CONDOR_HOST"]))
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEquals(remote_ad["MyAddress"], coll_ad["MyAddress"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def testScheddLocate(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.launch_daemons(["SCHEDD", "COLLECTOR"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ coll = condor.Collector()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ name = "%s@%s" % (condor.param["SCHEDD_NAME"], condor.param["CONDOR_HOST"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ schedd_ad = self.waitRemoteDaemon(condor.DaemonTypes.Schedd, name, timeout=10)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEquals(schedd_ad["Name"], name)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ def testCollectorAdvertise(self):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.launch_daemons(["COLLECTOR"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ print condor.param["COLLECTOR_HOST"]
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ coll = condor.Collector()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ now = time.time()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ad = classad.ClassAd('[MyType="GenericAd"; Name="Foo"; Foo=1; Bar=%f; Baz="foo"]' % now)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ coll.advertise([ad])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ for i in range(5):
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ ads = coll.query(condor.AdTypes.Any, 'Name =?= "Foo"', ["Bar"])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ if ads: break
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ time.sleep
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEquals(len(ads), 1)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertEquals(ads[0]["Bar"], now)
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ self.assertTrue("Foo" not in ads[0])
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+if __name__ == '__main__':
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+ unittest.main()
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
diff --git a/src/condor_contrib/python-bindings/tests/test.ad b/src/condor_contrib/python-bindings/tests/test.ad
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
index 0000000..06eeeb5
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+++ b/src/condor_contrib/python-bindings/tests/test.ad
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
@@ -0,0 +1,4 @@
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+[
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+foo = "bar";
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+baz = undefined;
|
|
![](https://seccdn.libravatar.org/avatar/7953a9093903b1598d828463f294c39ff77c20e7530429a55b48be9a3c3c0f35?s=16&d=retro) |
b019997 |
+]
|