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:

jobs -l
kill job_id

which is frustrating after many times of debugging.

Is ctrl+c feature implementable in RDataFrame?


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

#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
        return 0;


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

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

void foo() {
    auto counter = 0;
    while (true) {
        cout << counter++ << '\\n';


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

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.


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