Kill running script with RDataFrame

Hi all,

I often use ctrl+c to kill running scripts
This doesn’t stop RDataFrame at all.

Only way to kill it I found is:

ctrl+z
jobs -l
kill job_id
fg

which is frustrating after many times of debugging.

Is ctrl+c feature implementable in RDataFrame?

cheers,
Bohdan

I am not sure about that. May be the fact RDF works in parallel prevents that ? @eguiraud will surely know.

Works for me in a simple scenario, can you please share a reproducer?

Well, this I can’t cancel with ctrl+C

import ROOT


ROOT.gInterpreter.Declare('''
#include <iostream>
#include <unistd.h>

using namespace std;

double check_event(int x){
        if(x % 10000 == 0){
            cout<<"Print some info about the event status"<<endl;
            cout<<"Ev number:"<< x<<"   "<<endl;
            string dummy;
            // cout<<"Enter something to continue"<<endl;
            // cin>>dummy;
            }
        // Do some useless stuff
        usleep(1);
        return 0;
}

''')

df = ROOT.RDataFrame(10000000)
df = df.Define("i", "(int) rdfentry_")\
        .Define("zero", "check_event(i)")
h = df.Histo1D("zero").Draw()
input("wait")

Can you check?

Thank you,
I can reproduce the issue with a nightly build.
This seems to be a generic PyROOT issue (and a C++ RDF program can be interrupted without issues):

import ROOT

ROOT.gInterpreter.Declare('''
void foo() {
    auto counter = 0;
    while (true) {
        cout << counter++ << '\\n';
        usleep(1000000);
    }
}

''')

ROOT.foo()

@etejedor is it a bug that the snippet above cannot be interrupted with a SIGINT?

Hi,
I think this is the same issue as the one reported here:

The problem is that the signal is only handled when the control is given back to the Python interpreter.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.