<commit_before>package io.digdag.cli.client;

import java.util.Date;
import java.util.List;
import java.time.Instant;
import java.io.File;
import com.google.inject.Injector;
import com.google.inject.Scopes;
import com.google.common.base.Optional;
import com.beust.jcommander.Parameter;
import io.digdag.cli.SystemExitException;
import io.digdag.client.DigdagClient;
import io.digdag.client.api.RestSession;
import static io.digdag.cli.Main.systemExit;

public class Backfill
    extends ClientCommand
{
    @Parameter(names = {"-f", "--from"}, required = true)
    String fromTime;

    @Parameter(names = {"-R", "--attempt-name"}, required = true)
    String attemptName;

    // TODO -n for count
    // TODO -t for to-time

    @Parameter(names = {"-d", "--dry-run"})
    boolean dryRun = false;

    @Override
    public void mainWithClientException()
        throws Exception
    {
        if (args.size() != 1) {
            throw usage(null);
        }
        long schedId = parseLongOrUsage(args.get(0));

        backfill(schedId);
    }

    public SystemExitException usage(String error)
    {
        System.err.println("Usage: digdag backfill <schedule-id>");
        System.err.println("  Options:");
        System.err.println("    -f, --from 'yyyy-MM-dd HH:mm:ss Z'  timestamp to start backfill from (required)");
        System.err.println("    -R, --attempt-name NAME          session attempt name (required)");
        System.err.println("    -d, --dry-run                    tries to backfill and validates the results but does nothing");
        ClientCommand.showCommonOptions();
        return systemExit(error);
    }

    public void backfill(long schedId)
        throws Exception
    {
        Date from = Date.from(parseTime(fromTime));<commit_msg>backfill command should show usage when no arguments are set<commit_after>package io.digdag.cli.client;

import java.util.Date;
import java.util.List;
import java.time.Instant;
import java.io.File;
import com.google.inject.Injector;
import com.google.inject.Scopes;
import com.google.common.base.Optional;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.ParameterException;
import io.digdag.cli.SystemExitException;
import io.digdag.client.DigdagClient;
import io.digdag.client.api.RestSession;
import static io.digdag.cli.Main.systemExit;

public class Backfill
    extends ClientCommand
{
    @Parameter(names = {"-f", "--from"})
    String fromTime;

    @Parameter(names = {"-R", "--attempt-name"})
    String attemptName;

    // TODO -n for count
    // TODO -t for to-time

    @Parameter(names = {"-d", "--dry-run"})
    boolean dryRun = false;

    @Override
    public void mainWithClientException()
        throws Exception
    {
        if (args.size() != 1) {
            throw usage(null);
        }
        long schedId = parseLongOrUsage(args.get(0));

        backfill(schedId);
    }

    public SystemExitException usage(String error)
    {
        System.err.println("Usage: digdag backfill <schedule-id>");
        System.err.println("  Options:");
        System.err.println("    -f, --from 'yyyy-MM-dd HH:mm:ss Z'  timestamp to start backfill from (required)");
        System.err.println("    -R, --attempt-name NAME          session attempt name (required)");
        System.err.println("    -d, --dry-run                    tries to backfill and validates the results but does nothing");
        ClientCommand.showCommonOptions();
        return systemExit(error);
    }

    public void backfill(long schedId)
        throws Exception
    {
        if (fromTime == null || attemptName == null) {
            throw new ParameterException("-f, --from option and -R, --attempt-name option are required");
        }

        Date from = Date.from(parseTime(fromTime));
{'fraction_non_alphanumeric': 0.1256931608133087, 'fraction_numerical': 0.0010562450488513335, 'mean_word_length': 2.7210216110019645, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1887549', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1107, 'n_words': 282}