@@ -111,6 +111,11 @@ const std::string Setup::getSubmittedBy() {
111111 return getSetupValue (" LODA_SUBMITTED_BY" );
112112}
113113
114+ void Setup::setSubmittedBy (const std::string& submited_by) {
115+ getSubmittedBy ();
116+ SETUP[" LODA_SUBMITTED_BY" ] = submited_by;
117+ }
118+
114119void Setup::setMinersConfig (const std::string& loda_config) {
115120 MINERS_CONFIG = loda_config;
116121}
@@ -185,6 +190,8 @@ MiningMode Setup::getMiningMode() {
185190 return static_cast <MiningMode>(MINING_MODE);
186191}
187192
193+ void Setup::setMiningMode (MiningMode mode) { MINING_MODE = mode; }
194+
188195int64_t Setup::getMaxMemory () {
189196 if (MAX_MEMORY == UNDEFINED_INT) {
190197 // 1 GB default
@@ -244,6 +251,11 @@ bool Setup::shouldReportCPUHours() {
244251 getSetupFlag (LODA_SUBMIT_CPU_HOURS, false ));
245252}
246253
254+ void Setup::forceCPUHours () {
255+ getSetupFlag (LODA_SUBMIT_CPU_HOURS, false );
256+ SETUP[LODA_SUBMIT_CPU_HOURS] = " yes" ;
257+ }
258+
247259void trimString (std::string& str) {
248260 while (!str.empty ()) {
249261 if (str.front () == ' ' ) {
@@ -414,9 +426,19 @@ bool Setup::checkEnvVars() {
414426 return true ;
415427}
416428
429+ bool Setup::existsProgramsHome () {
430+ return isDir (LODA_HOME + " programs" + FILE_SEP + " oeis" );
431+ }
432+
433+ bool Setup::cloneProgramsHome (std::string git_url) {
434+ const std::string git_clone =
435+ " git clone " + git_url + " \" " + getLodaHome () + " programs\" " ;
436+ return system (git_clone.c_str ()) == 0 ;
437+ }
438+
417439bool Setup::checkProgramsHome () {
418440 std::string line;
419- if (!isDir (LODA_HOME + " programs " + FILE_SEP + " oeis " )) {
441+ if (!existsProgramsHome ( )) {
420442 std::cout << " LODA needs to download its programs repository from GitHub."
421443 << std::endl;
422444 std::cout << " It contains programs for more than 50,000 integer sequences."
@@ -446,9 +468,7 @@ bool Setup::checkProgramsHome() {
446468 if (!line.empty ()) {
447469 git_url = line;
448470 }
449- std::string git_clone =
450- " git clone " + git_url + " \" " + LODA_HOME + " programs\" " ;
451- if (system (git_clone.c_str ()) != 0 ) {
471+ if (cloneProgramsHome (git_url)) {
452472 std::cout << std::endl
453473 << " Error cloning repository. Aborting setup." << std::endl;
454474 return false ;
0 commit comments