<commit_before>package com.jamierf.oversim.manager;

import com.jamierf.oversim.manager.util.DirectoryArchiver;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.time.DurationFormatUtils;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class SimulationConfig extends DataSet {

	protected final String configFile;
	protected final String configName;
	protected final File resultDir;
	protected final File logDir;
	protected final Map<String, String> parameters;
	protected final long startTime;

	public int pendingRuns;
	public int completedRuns;
	public int failedRuns;

	public SimulationConfig(String configFile, String configName, File resultRootDir, String id) throws IOException {
        this (configFile, configName, resultRootDir, id, new HashMap<String, String>(), 0);
	}

	public SimulationConfig(String configFile, String configName, File resultRootDir, String id, Map<String, String> globalParameters, int pendingRuns) throws IOException {
		this.configFile = configFile;
		this.configName = configName;
		this.pendingRuns = pendingRuns;

		resultDir = new File(resultRootDir, configName + "-" + id);
		if (!resultDir.mkdir())
			throw new RuntimeException("Unable to create result subdirectory.");

		logDir = new File(resultDir, "logs");
		if (!logDir.mkdir())
			throw new RuntimeException("Unable to create logs subdirectory.");

		// Create a map to hold overriding OverSim parameters for this specific config
		parameters = new HashMap<String, String>();
		parameters.putAll(globalParameters);

		// Add our new result directory as an override parameter
		parameters.put("result-dir", resultDir.getCanonicalPath());
<commit_msg>Dont try creating directories if they already exist<commit_after>package com.jamierf.oversim.manager;

import com.jamierf.oversim.manager.util.DirectoryArchiver;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.time.DurationFormatUtils;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class SimulationConfig extends DataSet {

	protected final String configFile;
	protected final String configName;
	protected final File resultDir;
	protected final File logDir;
	protected final Map<String, String> parameters;
	protected final long startTime;

	public int pendingRuns;
	public int completedRuns;
	public int failedRuns;

	public SimulationConfig(String configFile, String configName, File resultRootDir, String id) throws IOException {
        this (configFile, configName, resultRootDir, id, new HashMap<String, String>(), 0);
	}

	public SimulationConfig(String configFile, String configName, File resultRootDir, String id, Map<String, String> globalParameters, int pendingRuns) throws IOException {
		this.configFile = configFile;
		this.configName = configName;
		this.pendingRuns = pendingRuns;

		resultDir = new File(resultRootDir, configName + "-" + id);
		if (!resultDir.isDirectory() && !resultDir.mkdir())
			throw new RuntimeException("Unable to create result subdirectory.");

		logDir = new File(resultDir, "logs");
		if (!logDir.isDirectory() && !logDir.mkdir())
			throw new RuntimeException("Unable to create logs subdirectory.");

		// Create a map to hold overriding OverSim parameters for this specific config
		parameters = new HashMap<String, String>();
		parameters.putAll(globalParameters);

		// Add our new result directory as an override parameter
		parameters.put("result-dir", resultDir.getCanonicalPath());

{'fraction_non_alphanumeric': 0.09139633286318759, 'fraction_numerical': 0.0005641748942172073, 'mean_word_length': 5.423913043478261, 'pattern_counts': {'":': 0, '<': 11, '<?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': '5562776', 'n_tokens_mistral': 1020, 'n_tokens_neox': 954, 'n_words': 313}