Ejemplo n.º 1
0
if not PROJECT_ID:
  print("Your project ID could not be determined.")
  print("Set the environment variable YOUR_PROJECT or run \"gcloud init\".")
  sys.exit(1)

print("  Project ID detected as: %s" % PROJECT_ID)

if "YOUR_BUCKET" in os.environ:
  DSUB_BUCKET = os.environ["YOUR_BUCKET"]
else:
  DSUB_BUCKET = "%s-dsub-test" % os.environ["USER"]

print("  Bucket detected as: %s" % DSUB_BUCKET)

print("  Checking if bucket exists")
if not test_util.gsutil_ls_check("gs://%s" % DSUB_BUCKET):
  print("Bucket does not exist: %s" % DSUB_BUCKET, file=sys.stderr)
  print("Create the bucket with \"gsutil mb\".", file=sys.stderr)
  sys.exit(1)

# Set standard LOGGING, INPUTS, and OUTPUTS values
TEST_GCS_ROOT = "gs://%s/dsub/py/%s/%s" % (DSUB_BUCKET, DSUB_PROVIDER,
                                           TEST_NAME)
TEST_GCS_DOCKER_ROOT = "gs/%s/dsub/py/%s/%s" % (DSUB_BUCKET, DSUB_PROVIDER,
                                                TEST_NAME)

if TASKS_FILE:
  # For task file tests, the logging path is a directory.
  LOGGING = "%s/logging" % TEST_GCS_ROOT
else:
  # For regular tests, the logging path is a named file.
Ejemplo n.º 2
0
if not PROJECT_ID:
    print "Your project ID could not be determined."
    print "Set the environment variable YOUR_PROJECT or run \"gcloud init\"."
    sys.exit(1)

print "  Project ID detected as: %s" % PROJECT_ID

if "YOUR_BUCKET" in os.environ:
    DSUB_BUCKET = os.environ["YOUR-BUCKET"]
else:
    DSUB_BUCKET = "%s-dsub-test" % os.environ["USER"]

print "  Bucket detected as: %s" % DSUB_BUCKET

print "  Checking if bucket exists"
if not test_util.gsutil_ls_check("gs://%s" % DSUB_BUCKET):
    print >> sys.stderr, "Bucket does not exist: %s" % DSUB_BUCKET
    print >> sys.stderr, "Create the bucket with \"gsutil mb\"."
    sys.exit(1)

# Set standard LOGGING, INPUTS, and OUTPUTS values
if TABLE_FILE:
    # For table-based tests, the logging path is a directory.
    # Eventually each job should have its own sub-directory,
    # and named logging files but we need to add dsub support for that.
    LOGGING = "gs://%s/dsub/py/%s/logging/" % (DSUB_BUCKET, TEST_NAME)
else:
    # For regular tests, the logging path is a named file.
    LOGGING = "gs://%s/dsub/py/%s/logging/%s.log" % (DSUB_BUCKET, TEST_NAME,
                                                     TEST_NAME)
    STDOUT_LOG = "%s/%s-stdout.log" % (os.path.dirname(LOGGING), TEST_NAME)