| 43 | constexpr char kOAuthScope[] = "https://www.googleapis.com/auth/cloud-platform"; |
| 44 | |
| 45 | Status RetrieveGcsFs(OpKernelContext* ctx, RetryingGcsFileSystem** fs) { |
| 46 | DCHECK(fs != nullptr); |
| 47 | *fs = nullptr; |
| 48 | |
| 49 | FileSystem* filesystem = nullptr; |
| 50 | TF_RETURN_IF_ERROR( |
| 51 | ctx->env()->GetFileSystemForFile("gs://fake/file.text", &filesystem)); |
| 52 | if (filesystem == nullptr) { |
| 53 | return errors::FailedPrecondition("The GCS file system is not registered."); |
| 54 | } |
| 55 | |
| 56 | *fs = dynamic_cast<RetryingGcsFileSystem*>(filesystem); |
| 57 | if (*fs == nullptr) { |
| 58 | return errors::Internal( |
| 59 | "The filesystem registered under the 'gs://' scheme was not a " |
| 60 | "tensorflow::RetryingGcsFileSystem*."); |
| 61 | } |
| 62 | return Status::OK(); |
| 63 | } |
| 64 | |
| 65 | template <typename T> |
| 66 | Status ParseScalarArgument(OpKernelContext* ctx, StringPiece argument_name, |
no test coverage detected