From 3d8e01a7c77e3d94b6f598bdd438dc5638f92987 Mon Sep 17 00:00:00 2001 From: Kory Draughn Date: Wed, 23 Apr 2025 16:14:32 -0400 Subject: [PATCH 1/2] [irods/irods#8333] Add stubs for setup/teardown plugin operations. --- src/main.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index f36f4b7..cba2fe8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -379,6 +379,16 @@ namespace } } // anonymous namespace +static irods::error setup(irods::default_re_ctx&, const std::string& _instance_name) +{ + return SUCCESS(); +} // setup + +static irods::error teardown(irods::default_re_ctx&, const std::string& _instance_name) +{ + return SUCCESS(); +} // teardown + static irods::error start(irods::default_re_ctx&, const std::string& _instance_name) { python_state::ts_main = nullptr; @@ -993,6 +1003,13 @@ extern "C" irods::pluggable_rule_engine* plugin_factory(c { irods::pluggable_rule_engine* re = new irods::pluggable_rule_engine(_inst_name, _context); + + re->add_operation( + "setup", std::function(setup)); + + re->add_operation( + "teardown", std::function(teardown)); + re->add_operation( "start", std::function(start)); From 46b817d5f1d5c242c2cbf9965481a108a37539d3 Mon Sep 17 00:00:00 2001 From: Kory Draughn Date: Fri, 25 Apr 2025 11:51:16 -0400 Subject: [PATCH 2/2] [irods/irods#7904] Remove rule files associated with server monitoring MSIs --- python_rules/rulemsiDigestMonStat.r | 24 ------------------------ python_rules/rulemsiFlushMonStat.r | 24 ------------------------ python_rules/rulemsiServerMonPerf.r | 6 ------ 3 files changed, 54 deletions(-) delete mode 100644 python_rules/rulemsiDigestMonStat.r delete mode 100644 python_rules/rulemsiFlushMonStat.r delete mode 100644 python_rules/rulemsiServerMonPerf.r diff --git a/python_rules/rulemsiDigestMonStat.r b/python_rules/rulemsiDigestMonStat.r deleted file mode 100644 index cf4a492..0000000 --- a/python_rules/rulemsiDigestMonStat.r +++ /dev/null @@ -1,24 +0,0 @@ -def main(rule_args, callback, rei): - cpu_weight = irods_rule_vars['*Cpuw'][1:-1] - mem_weight = irods_rule_vars['*Memw'][1:-1] - swap_weight = irods_rule_vars['*Swapw'][1:-1] - run_queue_weight = irods_rule_vars['*Runw'][1:-1] - disk_weight = irods_rule_vars['*Diskw'][1:-1] - network_in_weight = irods_rule_vars['*Netinw'][1:-1] - network_out_weight = irods_rule_vars['*Netow'][1:-1] - - callback.msiDigestMonStat(cpu_weight, mem_weight, swap_weight, run_queue_weight, disk_weight, network_in_weight, network_out_weight) - - callback.writeLine('stdout', 'CPU weight is ' + cpu_weight + ', Memory weight is ' + mem_weight + ', Swap weight is ' + swap_weight + ', Run queue weight is ' + run_queue_weight) - callback.writeLine('stdout', 'Disk weight is ' + disk_weight + ', Network transfer in weight is ' + network_in_weight + ', Network transfer out weight is ' + network_out_weight) - - ret_val = callback.msiExecStrCondQuery('SELECT SLD_RESC_NAME, SLD_LOAD_FACTOR', irods_types.GenQueryOut()) - genQueryOut = ret_val['arguments'][1] - - for row in range(genQueryOut.rowCnt): - resc_name = genQueryOut.sqlResult[0].row(row) - load_factor = genQueryOut.sqlResult[0].row(row) - callback.writeLine('stdout', resc_name + ' = ' + load_factor) - -INPUT *Cpuw="1", *Memw="1", *Swapw="0", *Runw="0", *Diskw="0", *Netinw="1", *Netow="1" -OUTPUT ruleExecOut diff --git a/python_rules/rulemsiFlushMonStat.r b/python_rules/rulemsiFlushMonStat.r deleted file mode 100644 index 925d39b..0000000 --- a/python_rules/rulemsiFlushMonStat.r +++ /dev/null @@ -1,24 +0,0 @@ -def main(rule_args, callback, rei): - time = irods_rule_vars['*Time'][1:-1] - table = irods_rule_vars['*Table'][1:-1] - cpu_weight = irods_rule_vars['*Cpuw'][1:-1] - mem_weight = irods_rule_vars['*Memw'][1:-1] - swap_weight = irods_rule_vars['*Swapw'][1:-1] - run_queue_weight = irods_rule_vars['*Runw'][1:-1] - disk_weight = irods_rule_vars['*Diskw'][1:-1] - network_in_weight = irods_rule_vars['*Netinw'][1:-1] - network_out_weight = irods_rule_vars['*Netow'][1:-1] - - callback.msiFlushMonStat(time, table) - callback.msiDigestMonStat(cpu_weight, mem_weight, swap_weight, run_queue_weight, disk_weight, network_in_weight, network_out_weight) - - ret_val = callback.msiExecStrCondQuery('SELECT SLD_RESC_NAME, SLD_LOAD_FACTOR', irods_types.GenQueryOut()) - genQueryOut = ret_val['arguments'][1] - - for row in range(genQueryOut.rowCnt): - resc_name = genQueryOut.sqlResult[0].row(row) - load_factor = genQueryOut.sqlResult[1].row(row) - callback.writeLine('stdout', resc_name + ' = ' + load_factor) - -INPUT *Time="24", *Table="serverLoad", *Cpuw="1", *Memw="1", *Swapw="0", *Runw="0", *Diskw="0", *Netinw="1", *Netow="1" -OUTPUT ruleExecOut diff --git a/python_rules/rulemsiServerMonPerf.r b/python_rules/rulemsiServerMonPerf.r deleted file mode 100644 index 698c8aa..0000000 --- a/python_rules/rulemsiServerMonPerf.r +++ /dev/null @@ -1,6 +0,0 @@ -def main(rule_args, callback, rei): - callback.msiServerMonPerf('default', 'default') - callback.msiServerMonPerf('verbose', 'default') - -INPUT null -OUTPUT ruleExecOut