Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add priority to hq command #66

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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<int> HyperQueueJob::job_count = 0;
linusseelinger marked this conversation as resolved.
Show resolved Hide resolved

int main(int argc, char *argv[])
{
create_directory_if_not_existing("urls");
Expand Down
4 changes: 4 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<int> 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,8 @@ class HyperQueueJob

// Submit the HQ job and retrieve the HQ job ID.
std::string job_id = getCommandOutput(hq_command);
// TODO MUTEX
linusseelinger marked this conversation as resolved.
Show resolved Hide resolved
job_count--;

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