dsub/providers/google_v2_operations.py
def is_dsub_operation(op):
  """Determine if a pipelines operation is a dsub request.

  We don't have a rigorous way to identify an operation as being submitted
  by dsub. Our best option is to check for certain fields that have always
  been part of dsub operations.

  - labels: job-id, job-name, and user-id have always existed. The dsub-version
            label has always existed for the google-v2 provider.

  Args:
    op: a pipelines operation.

  Returns:
    Boolean, true if the pipeline run was generated by dsub.
  """
  if not is_pipeline(op):
    return False

  for name in ['dsub-version', 'job-id', 'job-name', 'user-id']:
    if not get_label(op, name):
      return False

  return True
def is_dsub_operation(op):
  """Determine if a pipelines operation is a dsub request.

  We don't have a rigorous way to identify an operation as being submitted
  by dsub. Our best option is to check for certain fields that have always
  been part of dsub operations.

  - labels: job-id, job-name, and user-id have always existed. The dsub-version
            label has always existed for the google-v2 provider.

  Args:
    op: a pipelines operation.

  Returns:
    Boolean, true if the pipeline run was generated by dsub.
  """
  if not is_pipeline(op):
    return False

  for name in ['dsub-version', 'job-id', 'job-name', 'user-id']:
    if not get_label(op, name):
      return False

  return True
Determine if a pipelines operation is a dsub request.

  We don't have a rigorous way to identify an operation as being submitted
  by dsub. Our best option is to check for certain fields that have always
  been part of dsub operations.

  - labels: job-id, job-name, and user-id have always existed. The dsub-version
            label has always existed for the google-v2 provider.

  Args:
    op: a pipelines operation.

  Returns:
    Boolean, true if the pipeline run was generated by dsub.