func main() { storageUrl := flag.String("url", "", "") mode := flag.String("mode", "", "") flag.Parse() if *storageUrl == "" { return } stor := storage.NewStorage() err := stor.SetDefault(*storageUrl) if err != nil { log.Fatal(err) } backend := stor.Default.(storage.ProblemStore) if *mode == "import" { err = importProblems(flag.Arg(0), backend) if err != nil { log.Fatal(err) } } if *mode == "cleanup" { backend.Cleanup(1) } }
func NewContester(configFile string, gData *platform.GlobalData) (*Contester, error) { config, err := conf.ReadConfigFile(configFile) if err != nil { return nil, err } var result Contester result.InvokerId = getHostname() result.Env = getLocalEnvironment() result.ServerAddress, err = config.GetString("default", "server") if err != nil { return nil, err } result.Platform = PLATFORM_ID result.Disks = PLATFORM_DISKS result.ProgramFiles = PLATFORM_PFILES result.PathSeparator = string(os.PathSeparator) result.GData = gData result.Storage = storage.NewStorage() result.Sandboxes, err = configureSandboxes(config) if err != nil { return nil, err } return &result, nil }