<commit_before>/***************************************************************
 *
 * Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
 * University of Wisconsin-Madison, WI.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License.  You may
 * obtain a copy of the License at
 * 
 *	http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ***************************************************************/


#include "condor_common.h"
#include "condor_config.h"
#include "condor_daemon_core.h"
#include "subsystem_info.h"
#include "basename.h"
#include "setenv.h"
#include "dag.h"
#include "debug.h"
#include "parse.h"
#include "my_username.h"
#include "condor_environ.h"
#include "dagman_main.h"
#include "dagman_commands.h"
#include "condor_getcwd.h"
#include "condor_version.h"
#include "subsystem_info.h"
#include "dagman_metrics.h"

void ExitSuccess();

	// From condor_utils/condor_config.C
	// Note: these functions are declared 'extern "C"' where they're
	// implemented; if we don't do that here we get a link failure
	// (I think because of the name mangling).  wenger 2007-02-09.
//extern "C" void process_config_source( char* file, const char* name,
//			char* host, int required );
bool is_piped_command(const char* filename);

static std::string lockFileName;

static Dagman dagman;

strict_level_t Dagman::_strict = DAG_STRICT_1;

DagmanUtils dagmanUtils;

//---------------------------------------------------------------------------
static void Usage() {
	debug_printf( DEBUG_SILENT, "\nUsage: condor_dagman -f -t -l .\n"
			"\t\t-Lockfile <NAME.dag.lock>\n"
			"\t\t-Dag <NAME.dag>\n"
			"\t\t-CsdVersion <version string>\n"
			"\t\t[-Help]\n"
			"\t\t[-Version]\n"
		"\t\t[-Debug <level>]\n"
			"\t\t[-MaxIdle <int N>]\n"
			"\t\t[-MaxJobs <int N>]\n"
			"\t\t[-MaxPre <int N>]\n"
			"\t\t[-MaxPost <int N>]\n"
			"\t\t[-MaxHold <int N>]\n"
			"\t\t(obsolete) [-NoEventChecks]\n"
			"\t\t(obsolete) [-AllowLogError]\n"
			"\t\t[-DontAlwaysRunPost]\n"
			"\t\t[-AlwaysRunPost]\n"
			"\t\t[-WaitForDebug]\n"
			"\t\t[-UseDagDir]\n"
			"\t\t[-AutoRescue <0|1>]\n"
			"\t\t[-DoRescueFrom <int N>]\n"
			"\t\t[-AllowVersionMismatch]\n"
			"\t\t[-DumpRescue]\n"
			"\t\t[-Verbose]\n"
			"\t\t[-Force]\n"
			"\t\t[-Notification <never|always|complete|error>]\n"
			"\t\t[-Suppress_notification]\n"
			"\t\t[-Dont_Suppress_notification]\n"
			"\t\t[-Dagman <dagman_executable>]\n"
			"\t\t[-Outfile_dir <directory>]\n"
			"\t\t[-Update_submit]\n"
			"\t\t[-Import_env]\n"
			"\t\t[-Priority <int N>]\n"
			"\t\t[-dont_use_default_node_log] (no longer allowed)\n"
			"\t\t[-DoRecov]\n"
			"\twhere NAME is the name of your DAG.\n"
			"\tdefault -Debug is -Debug %d\n", DEBUG_VERBOSE );
	DC_Exit( EXIT_ERROR );
}

//---------------------------------------------------------------------------

#define MAX_IDLE_DEFAULT 1000
#define MAX_SUBMITS_PER_INT_DEFAULT 100
#define LOG_SCAN_INT_DEFAULT 5
#define SCHEDD_UPDATE_INTERVAL_DEFAULT 120

Dagman::Dagman() :
	dag (NULL),
	maxIdle (MAX_IDLE_DEFAULT),
	maxJobs (0),
	maxPreScripts (20),
	maxPostScripts (20),
	maxHoldScripts (20),
	paused (false),
	condorSubmitExe (NULL),
	condorRmExe (NULL),
	submit_delay (0),
	max_submit_attempts (6),
	max_submits_per_interval (MAX_SUBMITS_PER_INT_DEFAULT), // so Coverity is happy
	aggressive_submit (false),
	m_user_log_scan_interval (LOG_SCAN_INT_DEFAULT),
	schedd_update_interval (SCHEDD_UPDATE_INTERVAL_DEFAULT),
	primaryDagFile (""),
	multiDags (false),
	startup_cycle_detect (false), // so Coverity is happy
	useDagDir (false),
	allow_events (CheckEvents::ALLOW_NONE), // so Coverity is happy
	retrySubmitFirst (true), // so Coverity is happy
	retryNodeFirst (false), // so Coverity is happy
	mungeNodeNames (true), // so Coverity is happy
	prohibitMultiJobs (false), // so Coverity is happy
	abortDuplicates (true), // so Coverity is happy
	submitDepthFirst (false), // so Coverity is happy
	abortOnScarySubmit (true), // so Coverity is happy
	pendingReportInterval (10 * 60), // 10 minutes
	_dagmanConfigFile (NULL), // so Coverity is happy
	autoRescue(true),<commit_msg>Initialized new DAGMan member variable to keep Coverity happy (HTCONDOR-899)<commit_after>/***************************************************************
 *
 * Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
 * University of Wisconsin-Madison, WI.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License.  You may
 * obtain a copy of the License at
 * 
 *	http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ***************************************************************/


#include "condor_common.h"
#include "condor_config.h"
#include "condor_daemon_core.h"
#include "subsystem_info.h"
#include "basename.h"
#include "setenv.h"
#include "dag.h"
#include "debug.h"
#include "parse.h"
#include "my_username.h"
#include "condor_environ.h"
#include "dagman_main.h"
#include "dagman_commands.h"
#include "condor_getcwd.h"
#include "condor_version.h"
#include "subsystem_info.h"
#include "dagman_metrics.h"

void ExitSuccess();

	// From condor_utils/condor_config.C
	// Note: these functions are declared 'extern "C"' where they're
	// implemented; if we don't do that here we get a link failure
	// (I think because of the name mangling).  wenger 2007-02-09.
//extern "C" void process_config_source( char* file, const char* name,
//			char* host, int required );
bool is_piped_command(const char* filename);

static std::string lockFileName;

static Dagman dagman;

strict_level_t Dagman::_strict = DAG_STRICT_1;

DagmanUtils dagmanUtils;

//---------------------------------------------------------------------------
static void Usage() {
	debug_printf( DEBUG_SILENT, "\nUsage: condor_dagman -f -t -l .\n"
			"\t\t-Lockfile <NAME.dag.lock>\n"
			"\t\t-Dag <NAME.dag>\n"
			"\t\t-CsdVersion <version string>\n"
			"\t\t[-Help]\n"
			"\t\t[-Version]\n"
		"\t\t[-Debug <level>]\n"
			"\t\t[-MaxIdle <int N>]\n"
			"\t\t[-MaxJobs <int N>]\n"
			"\t\t[-MaxPre <int N>]\n"
			"\t\t[-MaxPost <int N>]\n"
			"\t\t[-MaxHold <int N>]\n"
			"\t\t(obsolete) [-NoEventChecks]\n"
			"\t\t(obsolete) [-AllowLogError]\n"
			"\t\t[-DontAlwaysRunPost]\n"
			"\t\t[-AlwaysRunPost]\n"
			"\t\t[-WaitForDebug]\n"
			"\t\t[-UseDagDir]\n"
			"\t\t[-AutoRescue <0|1>]\n"
			"\t\t[-DoRescueFrom <int N>]\n"
			"\t\t[-AllowVersionMismatch]\n"
			"\t\t[-DumpRescue]\n"
			"\t\t[-Verbose]\n"
			"\t\t[-Force]\n"
			"\t\t[-Notification <never|always|complete|error>]\n"
			"\t\t[-Suppress_notification]\n"
			"\t\t[-Dont_Suppress_notification]\n"
			"\t\t[-Dagman <dagman_executable>]\n"
			"\t\t[-Outfile_dir <directory>]\n"
			"\t\t[-Update_submit]\n"
			"\t\t[-Import_env]\n"
			"\t\t[-Priority <int N>]\n"
			"\t\t[-dont_use_default_node_log] (no longer allowed)\n"
			"\t\t[-DoRecov]\n"
			"\twhere NAME is the name of your DAG.\n"
			"\tdefault -Debug is -Debug %d\n", DEBUG_VERBOSE );
	DC_Exit( EXIT_ERROR );
}

//---------------------------------------------------------------------------

#define MAX_IDLE_DEFAULT 1000
#define MAX_SUBMITS_PER_INT_DEFAULT 100
#define LOG_SCAN_INT_DEFAULT 5
#define SCHEDD_UPDATE_INTERVAL_DEFAULT 120

Dagman::Dagman() :
	dag (NULL),
	maxIdle (MAX_IDLE_DEFAULT),
	maxJobs (0),
	maxPreScripts (20),
	maxPostScripts (20),
	maxHoldScripts (20),
	paused (false),
	condorSubmitExe (NULL),
	condorRmExe (NULL),
	submit_delay (0),
	max_submit_attempts (6),
	max_submits_per_interval (MAX_SUBMITS_PER_INT_DEFAULT), // so Coverity is happy
	aggressive_submit (false),
	m_user_log_scan_interval (LOG_SCAN_INT_DEFAULT),
	schedd_update_interval (SCHEDD_UPDATE_INTERVAL_DEFAULT),
	primaryDagFile (""),
	multiDags (false),
	startup_cycle_detect (false), // so Coverity is happy
	useDagDir (false),
	allow_events (CheckEvents::ALLOW_NONE), // so Coverity is happy
	retrySubmitFirst (true), // so Coverity is happy
	retryNodeFirst (false), // so Coverity is happy
	mungeNodeNames (true), // so Coverity is happy
	prohibitMultiJobs (false), // so Coverity is happy
	abortDuplicates (true), // so Coverity is happy
	submitDepthFirst (false), // so Coverity is happy
	abortOnScarySubmit (true), // so Coverity is happy
	useDirectSubmit (true), // so Coverity is happy
	pendingReportInterval (10 * 60), // 10 minutes
	_dagmanConfigFile (NULL), // so Coverity is happy
	autoRescue(true),
{'fraction_non_alphanumeric': 0.20308030803080307, 'fraction_numerical': 0.011111111111111112, 'mean_word_length': 3.5386919620569146, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6794836', 'n_tokens_mistral': 3472, 'n_tokens_neox': 3220, 'n_words': 800}