Search in sources :

Example 1 with GoogleNotebooks

use of bio.terra.cli.service.GoogleNotebooks in project terra-cli by DataBiosphere.

the class Start method execute.

@Override
protected void execute() {
    workspaceOption.overrideIfSpecified();
    InstanceName instanceName = instanceOption.toInstanceName();
    GoogleNotebooks notebooks = new GoogleNotebooks(Context.requireUser().getPetSACredentials());
    notebooks.start(instanceName);
    OUT.println("Notebook instance starting. It may take a few minutes before it is available");
}
Also used : InstanceName(bio.terra.cloudres.google.notebooks.InstanceName) GoogleNotebooks(bio.terra.cli.service.GoogleNotebooks) WorkspaceOverride(bio.terra.cli.command.shared.options.WorkspaceOverride)

Example 2 with GoogleNotebooks

use of bio.terra.cli.service.GoogleNotebooks in project terra-cli by DataBiosphere.

the class Stop method execute.

@Override
protected void execute() {
    workspaceOption.overrideIfSpecified();
    InstanceName instanceName = instanceOption.toInstanceName();
    GoogleNotebooks notebooks = new GoogleNotebooks(Context.requireUser().getPetSACredentials());
    notebooks.stop(instanceName);
    OUT.println("Notebook instance stopped");
}
Also used : InstanceName(bio.terra.cloudres.google.notebooks.InstanceName) GoogleNotebooks(bio.terra.cli.service.GoogleNotebooks) WorkspaceOverride(bio.terra.cli.command.shared.options.WorkspaceOverride)

Example 3 with GoogleNotebooks

use of bio.terra.cli.service.GoogleNotebooks in project terra-cli by DataBiosphere.

the class GcpNotebook method getInstance.

/**
 * Query the cloud for information about the notebook VM.
 */
public Optional<Instance> getInstance() {
    InstanceName instanceName = InstanceName.builder().projectId(projectId).location(location).instanceId(instanceId).build();
    GoogleNotebooks notebooks = new GoogleNotebooks(Context.requireUser().getPetSACredentials());
    try {
        return Optional.of(notebooks.get(instanceName));
    } catch (Exception ex) {
        logger.error("Caught exception looking up notebook instance", ex);
        return Optional.empty();
    }
}
Also used : InstanceName(bio.terra.cloudres.google.notebooks.InstanceName) GoogleNotebooks(bio.terra.cli.service.GoogleNotebooks) UserActionableException(bio.terra.cli.exception.UserActionableException)

Aggregations

GoogleNotebooks (bio.terra.cli.service.GoogleNotebooks)3 InstanceName (bio.terra.cloudres.google.notebooks.InstanceName)3 WorkspaceOverride (bio.terra.cli.command.shared.options.WorkspaceOverride)2 UserActionableException (bio.terra.cli.exception.UserActionableException)1