<commit_before>
# Flex ADLB data store with Turbine data
# No real Turbine data flow here

# This may be used as a benchmark by setting
# TURBINE_TEST_PARAM_1 in the environment

package require turbine 0.0.1

namespace import turbine::string_*

turbine::defaults
turbine::init $engines $servers

if { [ info exists env(TURBINE_TEST_PARAM_1) ] } {
    set iterations $env(TURBINE_TEST_PARAM_1)
} else {
    set iterations 4
}

if { ! [ adlb::amserver ] } {

    set rank [ adlb::rank ]
    puts "rank: $rank"
    if { $rank == 0 } {
	puts "iterations: $iterations"
    }
    set workers [ adlb::workers ]

    for { set i 0 } { $i < $iterations } { incr i } {
        set id [ expr $rank + $i * $workers + 1]
        adlb::create $id $adlb::STRING
        adlb::store $id $adlb::STRING "message rank:$rank:$i"

        set id [ expr $rank + $i * $workers + 1 ]
        # turbine::c::debug "get"
        set msg [ adlb::retrieve $id ]
        # turbine::c::debug "got: $msg"
    }
} else {
    adlb::server
}

turbine::finalize

puts OK<commit_msg>Data must be closed before it is read<commit_after>
# Flex ADLB data store with Turbine data
# No real Turbine data flow here

# This may be used as a benchmark by setting
# TURBINE_TEST_PARAM_1 in the environment

package require turbine 0.0.1

namespace import turbine::string_*

turbine::defaults
turbine::init $engines $servers

if { [ info exists env(TURBINE_TEST_PARAM_1) ] } {
    set iterations $env(TURBINE_TEST_PARAM_1)
} else {
    set iterations 4
}

if { ! [ adlb::amserver ] } {

    set rank [ adlb::rank ]
    puts "rank: $rank"
    if { $rank == 0 } {
	puts "iterations: $iterations"
    }
    set workers [ adlb::workers ]

    for { set i 0 } { $i < $iterations } { incr i } {
        set id [ expr $rank + $i * $workers + 1]
        adlb::create $id $adlb::STRING
        adlb::store $id $adlb::STRING "message rank:$rank:$i"
        adlb::close $id

        set id [ expr $rank + $i * $workers + 1 ]
        # turbine::c::debug "get"
        set msg [ adlb::retrieve $id ]
        # turbine::c::debug "got: $msg"
    }
} else {
    adlb::server
}

turbine::finalize

puts OK
{'fraction_non_alphanumeric': 0.12745098039215685, 'fraction_numerical': 0.01027077497665733, 'mean_word_length': 2.8267857142857142, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '201791', 'n_tokens_mistral': 794, 'n_tokens_neox': 757, 'n_words': 228}