1 /* 2 * JobsApi.hpp 3 * 4 * Copyright (C) 2021 by RStudio, PBC 5 * 6 * Unless you have received this program directly from RStudio pursuant 7 * to the terms of a commercial license agreement with RStudio, then 8 * this program is licensed to you under the terms of version 3 of the 9 * GNU Affero General Public License. This program is distributed WITHOUT 10 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the 12 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. 13 * 14 */ 15 16 #ifndef SESSION_JOBS_HPP 17 #define SESSION_JOBS_HPP 18 19 #include <session/jobs/Job.hpp> 20 21 namespace rstudio { 22 namespace core { 23 class Error; 24 } 25 } 26 27 namespace rstudio { 28 namespace session { 29 namespace modules { 30 namespace jobs { 31 32 boost::shared_ptr<Job> addJob( 33 const std::string& id, 34 time_t recorded, 35 time_t started, 36 time_t completed, 37 const std::string& name, 38 const std::string& status, 39 const std::string& group, 40 int progress, 41 bool confirmTermination, 42 JobState state, 43 JobType type, 44 const std::string& cluster, 45 bool autoRemove, 46 SEXP actions, 47 JobActions cppActions, 48 bool show, 49 bool saveOutput, 50 std::vector<std::string> tags); 51 52 boost::shared_ptr<Job> addJob( 53 const std::string& name, 54 const std::string& status, 55 const std::string& group, 56 int progress, 57 bool confirmTermination, 58 JobState state, 59 JobType type, 60 bool autoRemove, 61 SEXP actions, 62 JobActions cppActions, 63 bool show, 64 std::vector<std::string> tags); 65 66 void removeJob(boost::shared_ptr<Job> pJob); 67 68 bool lookupJob(const std::string& id, boost::shared_ptr<Job> *pJob); 69 70 void setJobProgress(boost::shared_ptr<Job> pJob, int units); 71 72 void setJobProgressMax(boost::shared_ptr<Job> pJob, int max); 73 74 void setJobState(boost::shared_ptr<Job> pJob, JobState state); 75 76 void setJobStatus(boost::shared_ptr<Job> pJob, const std::string& status); 77 78 core::json::Object jobsAsJson(); 79 80 void removeAllJobs(); 81 82 void removeAllLocalJobs(); 83 84 void removeAllLauncherJobs(); 85 86 void removeCompletedLocalJobs(); 87 88 void endAllJobStreaming(); 89 90 bool localJobsRunning(); 91 92 } // namespace jobs 93 } // namespace modules 94 } // namespace session 95 } // namespace rstudio 96 97 #endif 98