diff options
| author | apachee <[email protected]> | 2024-05-24 20:47:38 +0300 |
|---|---|---|
| committer | apachee <[email protected]> | 2024-05-24 20:58:06 +0300 |
| commit | 3e42aa91c70358fdd3ec39d0ac23072fc230b209 (patch) | |
| tree | 422612a54143006d874a3997b1ef10efe34da552 /yt/cpp/mapreduce/interface | |
| parent | b45547676013a5d43cd0072a85643326e686b6fc (diff) | |
YT-21308: Add redirect_stdout_to_stderr flag for C++ client
Adds redirect_stdout_to_stderr spec option for operations that allows writing to stdout as if it was stderr.
6a8ac5f21955a79848d86f72715628c7b8bb65c4
Diffstat (limited to 'yt/cpp/mapreduce/interface')
| -rw-r--r-- | yt/cpp/mapreduce/interface/config.h | 3 | ||||
| -rw-r--r-- | yt/cpp/mapreduce/interface/helpers.cpp | 18 | ||||
| -rw-r--r-- | yt/cpp/mapreduce/interface/helpers.h | 11 | ||||
| -rw-r--r-- | yt/cpp/mapreduce/interface/operation.cpp | 4 | ||||
| -rw-r--r-- | yt/cpp/mapreduce/interface/ya.make | 1 |
5 files changed, 36 insertions, 1 deletions
diff --git a/yt/cpp/mapreduce/interface/config.h b/yt/cpp/mapreduce/interface/config.h index de5f5ab7fcf..3debc8a9616 100644 --- a/yt/cpp/mapreduce/interface/config.h +++ b/yt/cpp/mapreduce/interface/config.h @@ -198,6 +198,9 @@ struct TConfig /// Which implemetation of table writer to use. ETableWriterVersion TableWriterVersion = ETableWriterVersion::Auto; + /// Redirects stdout to stderr for jobs. + bool RedirectStdoutToStderr = false; + static bool GetBool(const char* var, bool defaultValue = false); static int GetInt(const char* var, int defaultValue); static TDuration GetDuration(const char* var, TDuration defaultValue); diff --git a/yt/cpp/mapreduce/interface/helpers.cpp b/yt/cpp/mapreduce/interface/helpers.cpp new file mode 100644 index 00000000000..f396883ea5a --- /dev/null +++ b/yt/cpp/mapreduce/interface/helpers.cpp @@ -0,0 +1,18 @@ +#include "helpers.h" + +#include <util/string/cast.h> + +#include <util/system/env.h> + +namespace NYT { + +//////////////////////////////////////////////////////////////////////////////// + +int GetJobFirstOutputTableFD() +{ + return FromString<int>(GetEnv("YT_FIRST_OUTPUT_TABLE_FD", "1")); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT diff --git a/yt/cpp/mapreduce/interface/helpers.h b/yt/cpp/mapreduce/interface/helpers.h new file mode 100644 index 00000000000..0aa8086b49f --- /dev/null +++ b/yt/cpp/mapreduce/interface/helpers.h @@ -0,0 +1,11 @@ +#pragma once + +namespace NYT { + +//////////////////////////////////////////////////////////////////////////////// + +int GetJobFirstOutputTableFD(); + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT diff --git a/yt/cpp/mapreduce/interface/operation.cpp b/yt/cpp/mapreduce/interface/operation.cpp index b3229117d91..d5b9271bcd4 100644 --- a/yt/cpp/mapreduce/interface/operation.cpp +++ b/yt/cpp/mapreduce/interface/operation.cpp @@ -1,5 +1,7 @@ #include "operation.h" +#include <yt/cpp/mapreduce/interface/helpers.h> + #include <util/generic/iterator_range.h> namespace NYT { @@ -127,7 +129,7 @@ TRawJobContext::TRawJobContext(size_t outputTableCount) : InputFile_(Duplicate(0)) { for (size_t i = 0; i != outputTableCount; ++i) { - OutputFileList_.emplace_back(Duplicate(3 * i + 1)); + OutputFileList_.emplace_back(Duplicate(3 * i + GetJobFirstOutputTableFD())); } } diff --git a/yt/cpp/mapreduce/interface/ya.make b/yt/cpp/mapreduce/interface/ya.make index 1d76b1dabb6..f9bc3e172cf 100644 --- a/yt/cpp/mapreduce/interface/ya.make +++ b/yt/cpp/mapreduce/interface/ya.make @@ -11,6 +11,7 @@ SRCS( cypress.cpp errors.cpp format.cpp + helpers.cpp job_counters.cpp job_statistics.cpp io.cpp |
