<commit_before>import parsl
from parsl import *
import os

from parsl.data_provider.files import File

#parsl.set_stream_logger()

workers = ThreadPoolExecutor(max_workers=8)
dfk = DataFlowKernel(executors=[workers])


@App('bash', dfk)
def cat (inputs=[], outputs=[], stdout=None, stderr=None):
    infiles = ' '.join([i.filepath for i in inputs])
    cmd_line = '''echo %s
    cat %s &> {outputs[0]}
    ''' % (infiles, infiles)

def test_files():

    fs = [File('data/' + f) for f in os.listdir('data')]
    x = cat (inputs=fs, outputs=['cat_out.txt'], stdout='f_app.out', stderr='f_app.err')
    d_x = x.outputs[0]
    print(x.result())
    print(d_x, type(d_x))


@App('bash', dfk)
def increment(inputs=[], outputs=[], stdout=None, stderr=None):
    # Place double braces to avoid python complaining about missing keys for {item = $1}
    cmd_line = '''
    x=$(cat {inputs[0]})
    echo $(($x+1)) > {outputs[0]}
    '''

def test_increment(depth=5):
    ''' Test simple pipeline A->B...->N
    '''<commit_msg>Fixes for new bash updates<commit_after>import parsl
from parsl import *
import os

from parsl.data_provider.files import File

#parsl.set_stream_logger()

workers = ThreadPoolExecutor(max_workers=8)
dfk = DataFlowKernel(executors=[workers])


@App('bash', dfk)
def cat (inputs=[], outputs=[], stdout=None, stderr=None):
    infiles = ' '.join([i.filepath for i in inputs])
    return '''echo %s
    cat %s &> {outputs[0]}
    ''' % (infiles, infiles)


def test_files():

    fs = [File('data/' + f) for f in os.listdir('data')]
    x = cat (inputs=fs, outputs=['cat_out.txt'], stdout='f_app.out', stderr='f_app.err')
    d_x = x.outputs[0]
    print(x.result())
    print(d_x, type(d_x))


@App('bash', dfk)
def increment(inputs=[], outputs=[], stdout=None, stderr=None):
    # Place double braces to avoid python complaining about missing keys for {item = $1}
    return '''
    x=$(cat {inputs[0]})
    echo $(($x+1)) > {outputs[0]}
    '''

def test_increment(depth=5):
    ''' Test simple pipeline A->B...->N
    '''
{'fraction_non_alphanumeric': 0.1844946025515211, 'fraction_numerical': 0.007850834151128557, 'mean_word_length': 4.022167487684729, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3818225', 'n_tokens_mistral': 748, 'n_tokens_neox': 735, 'n_words': 184}