Skip to content

Commit

Permalink
Merge pull request #66 from sebwolf-de/main
Browse files Browse the repository at this point in the history
Add priority to hq command
  • Loading branch information
linusseelinger authored Mar 12, 2024
2 parents 1e357b0 + 510a4ed commit 2d12741
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hpc/LoadBalancer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ const std::vector<std::string> get_model_names() {
return umbridge::SupportedModels(hq_job.server_url);
}

std::atomic<int32_t> HyperQueueJob::job_count = 0;

int main(int argc, char *argv[])
{
create_directory_if_not_existing("urls");
Expand Down
3 changes: 3 additions & 0 deletions hpc/LoadBalancer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ int hq_submit_delay_ms = 0;
class HyperQueueJob
{
public:
static std::atomic<int32_t> job_count;
HyperQueueJob(std::string model_name, bool start_client=true,
bool force_default_submission_script=false)
{
Expand Down Expand Up @@ -113,6 +114,7 @@ class HyperQueueJob
const std::filesystem::path submission_script_model_specific("job_" + model_name + ".sh");

std::string hq_command = "hq submit --output-mode=quiet ";
hq_command += "--priority=" + std::to_string(job_count) + " ";
if (std::filesystem::exists(submission_script_dir / submission_script_model_specific) && !force_default_submission_script)
{
hq_command += (submission_script_dir / submission_script_model_specific).string();
Expand All @@ -128,6 +130,7 @@ class HyperQueueJob

// Submit the HQ job and retrieve the HQ job ID.
std::string job_id = getCommandOutput(hq_command);
job_count--;

// Delete the line break.
if (!job_id.empty())
Expand Down

0 comments on commit 2d12741

Please sign in to comment.