admin

package
v0.5.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InitCmd = &cli.Command{
	Name:  "init",
	Usage: "Initialize or upgrade the database",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:  "identity",
			Usage: "Name of the user or service that is running the Singularity for tracking and logging purpose",
		},
	},
	Description: "This commands need to be run before running any singularity daemon or after any version upgrade",
	Action: func(c *cli.Context) error {
		db, closer, err := database.OpenFromCLI(c)
		if err != nil {
			return errors.WithStack(err)
		}
		defer closer.Close()
		err = admin.Default.InitHandler(c.Context, db)
		if err != nil {
			return errors.WithStack(err)
		}
		if c.IsSet("identity") {
			err = admin.Default.SetIdentityHandler(c.Context, db, admin.SetIdentityRequest{
				Identity: c.String("identity"),
			})
			if err != nil {
				return errors.WithStack(err)
			}
		}
		return nil
	},
}
View Source
var MigrateDatasetCmd = &cli.Command{
	Name:  "migrate-dataset",
	Usage: "Migrate dataset from old singularity mongodb",
	Description: "Migrate datasets from singularity V1 to V2. Those steps include\n" +
		"  1. Create source storage and output storage and attach them to a dataprep in V2.\n" +
		"  2. Create all folder structures and files in the new dataset.\n" +
		"Caveats:\n" +
		"  1. The created preparation won't be compatible with the new dataset worker.\n" +
		"     So do not attempt to resume a data preparation or push new files onto migrated dataset.\n" +
		"     You can make deals or browse the dataset without issues.\n" +
		"  2. The folder CID won't be generated or migrated due to the complexity",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "mongo-connection-string",
			Usage:   "MongoDB connection string",
			EnvVars: []string{"MONGO_CONNECTION_STRING"},
			Value:   "mongodb://localhost:27017",
		},
		&cli.BoolFlag{
			Name:  "skip-files",
			Usage: "Skip migrating details about files and folders. This will make the migration much faster. Useful if you only want to make deals.",
			Value: false,
		},
	},
	Action: migrate.MigrateDataset,
}
View Source
var MigrateScheduleCmd = &cli.Command{
	Name:  "migrate-schedule",
	Usage: "Migrate schedule from old singularity mongodb",
	Description: "Migrate schedules from singularity V1 to V2. Note that\n" +
		"  1. You must complete dataset migration first\n" +
		"  2. All new schedules will be created with status 'paused'\n" +
		"  3. The deal states will not be migrated over as it will be populated with deal tracker automatically\n" +
		"  4. --output-csv is no longer supported. We will provide a new tool in the future\n" +
		"  5. # of replicas is no longer supported as part of the schedule. We will make this a configurable policy in the future\n" +
		"  6. --force is no longer supported. We may add similar support to ignore all policy restrictions in the future\n" +
		"  7. --offline is no longer supported. It will be always offline deal for legacy market and online deal for boost market if URL template is configured",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "mongo-connection-string",
			Usage:   "MongoDB connection string",
			EnvVars: []string{"MONGO_CONNECTION_STRING"},
			Value:   "mongodb://localhost:27017",
		},
	},
	Action: migrate.MigrateSchedule,
}
View Source
var ResetCmd = &cli.Command{
	Name:  "reset",
	Usage: "Reset the database",
	Flags: []cli.Flag{cliutil.ReallyDotItFlag},
	Action: func(c *cli.Context) error {
		if err := cliutil.HandleReallyDoIt(c); err != nil {
			return errors.WithStack(err)
		}
		db, closer, err := database.OpenFromCLI(c)
		if err != nil {
			return errors.WithStack(err)
		}
		defer closer.Close()
		return admin.Default.ResetHandler(c.Context, db)
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL