|
84 | 84 | #include <library/cpp/getopt/last_getopt.h>
|
85 | 85 | #include <library/cpp/logger/priority.h>
|
86 | 86 | #include <library/cpp/protobuf/util/pb_io.h>
|
| 87 | +#include <library/cpp/digest/md5/md5.h> |
87 | 88 | #include <ydb/library/actors/http/http_proxy.h>
|
88 | 89 |
|
89 | 90 | #include <util/generic/string.h>
|
@@ -164,6 +165,28 @@ void ReadGatewaysConfig(const TString& configFile, TGatewaysConfig* config, THas
|
164 | 165 | }
|
165 | 166 | }
|
166 | 167 |
|
| 168 | +void PatchGatewaysConfig(TGatewaysConfig* config, const TString& mrJobBin, const TString& mrJobUdfsDir, |
| 169 | + size_t numThreads, bool keepTemp) |
| 170 | +{ |
| 171 | + auto ytConfig = config->MutableYt(); |
| 172 | + ytConfig->SetGatewayThreads(numThreads); |
| 173 | + if (mrJobBin.empty()) { |
| 174 | + ytConfig->ClearMrJobBin(); |
| 175 | + } else { |
| 176 | + ytConfig->SetMrJobBin(mrJobBin); |
| 177 | + ytConfig->SetMrJobBinMd5(MD5::File(mrJobBin)); |
| 178 | + } |
| 179 | + |
| 180 | + if (mrJobUdfsDir.empty()) { |
| 181 | + ytConfig->ClearMrJobUdfsDir(); |
| 182 | + } else { |
| 183 | + ytConfig->SetMrJobUdfsDir(mrJobUdfsDir); |
| 184 | + } |
| 185 | + auto attr = ytConfig->MutableDefaultSettings()->Add(); |
| 186 | + attr->SetName("KeepTempTables"); |
| 187 | + attr->SetValue(keepTemp ? "yes" : "no"); |
| 188 | +} |
| 189 | + |
167 | 190 | TFileStoragePtr CreateFS(const TString& paramsFile, const TString& defYtServer) {
|
168 | 191 | TFileStorageConfig params;
|
169 | 192 | LoadFsConfigFromFile(paramsFile ? paramsFile : "../../../../../yql/cfg/local/fs.conf", params);
|
@@ -454,6 +477,9 @@ int RunMain(int argc, const char* argv[])
|
454 | 477 | int verbosity = 3;
|
455 | 478 | bool showLog = false;
|
456 | 479 | bool emulateYt = false;
|
| 480 | + TString mrJobBin; |
| 481 | + TString mrJobUdfsDir; |
| 482 | + size_t numYtThreads = 1; |
457 | 483 | TString token = GetEnv("YQL_TOKEN");
|
458 | 484 | if (!token) {
|
459 | 485 | TString home = GetEnv("HOME");
|
@@ -550,6 +576,16 @@ int RunMain(int argc, const char* argv[])
|
550 | 576 | .Optional()
|
551 | 577 | .NoArgument()
|
552 | 578 | .SetFlag(&udfResolverFilterSyscalls);
|
| 579 | + opts.AddLongOption("mrjob-bin", "Path to mrjob binary") |
| 580 | + .Optional() |
| 581 | + .StoreResult(&mrJobBin); |
| 582 | + opts.AddLongOption("mrjob-udfsdir", "Path to udfs for mr jobs") |
| 583 | + .Optional() |
| 584 | + .StoreResult(&mrJobUdfsDir); |
| 585 | + opts.AddLongOption("yt-threads", "YT gateway threads") |
| 586 | + .Optional() |
| 587 | + .RequiredArgument("COUNT") |
| 588 | + .StoreResult(&numYtThreads); |
553 | 589 | opts.AddLongOption('v', "verbosity", "Log verbosity level")
|
554 | 590 | .Optional()
|
555 | 591 | .RequiredArgument("LEVEL")
|
@@ -737,6 +773,7 @@ int RunMain(int argc, const char* argv[])
|
737 | 773 |
|
738 | 774 | TGatewaysConfig gatewaysConfig;
|
739 | 775 | ReadGatewaysConfig(gatewaysCfgFile, &gatewaysConfig, sqlFlags);
|
| 776 | + PatchGatewaysConfig(&gatewaysConfig, mrJobBin, mrJobUdfsDir, numYtThreads, res.Has("keep-temp")); |
740 | 777 | if (runOptions.AnalyzeQuery) {
|
741 | 778 | auto* setting = gatewaysConfig.MutableDq()->AddDefaultSettings();
|
742 | 779 | setting->SetName("AnalyzeQuery");
|
|
0 commit comments