<commit_before>package run

import (
	"github.com/workanator/go-floc.v2"
)

const locRepeat = "Repeat"

/*
Repeat repeats running jobs for N times. Jobs start sequentially.

Summary:
	- Run jobs in goroutines : NO
	- Wait all jobs finish   : YES
	- Run order              : SEQUENCE

Diagram:
                          NO
    +-----------[JOB]<---------+
    |                          |
    V                          | YES
  ----(ITERATED COUNT TIMES?)--+---->
*/
func Repeat(count int, jobs ...floc.Job) floc.Job {
	return func(ctx floc.Context, ctrl floc.Control) error {
		for n := 1; n <= count; n++ {
			for _, job := range jobs {
				// Do not start the next job if the execution is finished
				if ctrl.IsFinished() {
					return nil
				}

				// Do the job
				err := job(ctx, ctrl)
				if handledErr := handleResult(ctrl, err, locRepeat); handledErr != nil {
					return handledErr
				}
			}
		}

		return nil
	}
}<commit_msg>Repeat takes only one job<commit_after>package run

import (
	"github.com/workanator/go-floc.v2"
)

const locRepeat = "Repeat"

/*
Repeat repeats running jobs for N times. Jobs start sequentially.

Summary:
	- Run jobs in goroutines : NO
	- Wait all jobs finish   : YES
	- Run order              : SEQUENCE

Diagram:
                          NO
    +-----------[JOB]<---------+
    |                          |
    V                          | YES
  ----(ITERATED COUNT TIMES?)--+---->
*/
func Repeat(count int, job floc.Job) floc.Job {
	return func(ctx floc.Context, ctrl floc.Control) error {
		for n := 1; n <= count; n++ {
			// Do not start the job if the execution is finished
			if ctrl.IsFinished() {
				return nil
			}

			// Do the job
			err := job(ctx, ctrl)
			if handledErr := handleResult(ctrl, err, locRepeat); handledErr != nil {
				return handledErr
			}
		}

		return nil
	}
}
{'fraction_non_alphanumeric': 0.1360914534567229, 'fraction_numerical': 0.002177463255307567, 'mean_word_length': 1.7189349112426036, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '174404', 'n_tokens_mistral': 673, 'n_tokens_neox': 586, 'n_words': 185}