90 template <
typename Cont>
102 template <
typename T>
109 template <
typename T>
118 const string& service_name,
119 const string& queue_name);
131 const string& service_name,
132 const string& queue_name)
134 list<string> cln_names;
136 list<string>
names(cln_names.begin(), cln_names.end());
145 list<string> inc_names(cln_names.begin(), cln_names.end());
147 inc_names.erase(
remove_if(inc_names.begin(),inc_names.end(),
151 names.insert(
names.begin(),inc_names.begin(), inc_names.end());
155 m_EnvValues.push_back(it->first +
"=" +it->second);
159 if (added_env.
find(*it) == added_env.
end())
163 list<string> local_names;
166 ITERATE(list<string>, it, local_names) {
167 const string& s = *it;
168 if (added_env.
find(s) == added_env.
end()
173 m_EnvValues.push_back(
"NCBI_NS_SERVICE=" + service_name);
174 m_EnvValues.push_back(
"NCBI_NS_QUEUE=" + queue_name);
188 m_Env.push_back(it->c_str());
212 if (
context.IsLogRequested()) {
217 unique_ptr<CCgiRequest> request;
225 ERR_POST(
"Cannot deserialize remote_cgi job");
227 "Error while parsing CGI request stream");
232 request->GetEnvironment(),
234 context.GetWorkerNode().GetServiceName(),
256 if (
context.IsLogRequested()) {
261 " is " <<
context.GetCommitStatusDescription(
263 ". Exit code: " << ret <<
264 "; output: " <<
context.GetJobOutput());
272 m_RemoteAppLauncher(remote_app_launcher)
277 #define GRID_APP_NAME "remote_cgi"
282 int main(
int argc,
const char* argv[])
285 return Main<TRemoteAppJobFactory, CRemoteAppBaseListener>(argc, argv);
void remove_if(Container &c, Predicate *__pred)
vector< const char * > m_Env
const char *const * GetEnv() const
list< string > m_EnvValues
CCgiEnvHolder(const CRemoteAppLauncher &remote_app_launcher, const CNcbiEnvironment &client_env, const CNetScheduleJob &job, const string &service_name, const string &queue_name)
void SetReuseJobObject(bool value)
static CGridGlobals & GetInstance()
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
const CNcbiEnvironment & GetLocalEnv() const
const list< string > & GetIncludedEnv() const
const list< string > & GetExcludedEnv() const
void FinishJob(bool finished_ok, int ret, CWorkerNodeJobContext &context) const
bool ExecRemoteApp(const vector< string > &args, CNcbiIstream &in, CNcbiOstream &out, CNcbiOstream &err, int &exit_value, CWorkerNodeJobContext &job_context, unsigned app_run_timeout, const char *const env[]) const
const TEnvMap & GetAddedEnv() const
int Do(CWorkerNodeJobContext &context)
Execute the job.
CRemoteCgiJob(const IWorkerNodeInitContext &context, const CRemoteAppLauncher &remote_app_launcher)
const CRemoteAppLauncher & m_RemoteAppLauncher
Worker Node Job interface.
const_iterator end() const
const_iterator find(const key_type &key) const
static const struct name_t names[]
#define GRID_APP_CHECK_VERSION_ARGS()
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
@ fDoNotParseContent
do not automatically parse the request's content body (from "istr")
@ fIgnoreQueryString
do not parse $QUERY_STRING (or cmd.line if $REQUEST_METHOD not def)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
const string & Get(const string &name, bool *found=NULL) const
Get environment value by name.
void Enumerate(list< string > &names, const string &prefix=kEmptyStr) const
Find all variable names starting with an optional prefix.
string job_id
Output job key.
bool IsOssEmpty(CNcbiOstrstream &oss)
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
static int Compare(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Compare of a substring with another string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
where both of them are integers Note
std::istream & in(std::istream &in_, double &x_)
const char kGridAppName[]
int main(int argc, const char *argv[])
HasValue(const Cont &cont)
bool operator()(const string &val) const
static const char *const sm_StandardCgiEnv[]
bool operator()(const string &val) const
bool operator()(const string &val) const
static CS_CONTEXT * context