Ignore:
Timestamp:
Mar 9, 2017, 10:16:58 PM (8 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph_documentation, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_ChronosMutex, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids_IntegrationTest, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, StoppableMakroAction, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
Children:
89b42d
Parents:
fed1ae
git-author:
Frederik Heber <heber@…> (02/22/17 13:48:58)
git-committer:
Frederik Heber <heber@…> (03/09/17 22:16:58)
Message:

FIX: JobMarket's PoolWorker now uses ip addresses as hostname.

  • this fixes a problem with docker containers. When the container has disappeared, we can no longer resolve its hostname.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ThirdParty/JobMarket/src/JobMarket/WorkerOptions.cpp

    rfed1ae rc79d7a  
    2323
    2424#include <unistd.h>
     25#include <netdb.h>
     26#include <arpa/inet.h>
    2527
    2628#include "CodePatterns/Log.hpp"
     
    5254    char name[1024];
    5355    if (gethostname(name, 1023) == 0) {
    54       hostname = name;
    55       LOG(1, "INFO: Using obtained hostname " << hostname << ".");
     56      char ipaddress[1024];
     57      struct hostent *hostinfo = gethostbyname(name);
     58      // simply use the first address
     59      struct in_addr addr;
     60      memcpy(&addr, hostinfo->h_addr_list[0], sizeof(struct in_addr));
     61      strncpy(ipaddress,inet_ntoa(addr), 1023);
     62      hostname = ipaddress;
     63      LOG(1, "INFO: Using obtained ip address " << hostname << " obtained from hostname " << name << ".");
    5664    } else {
    5765      ELOG(1, "No hostname given and failed to determine automatically.");
Note: See TracChangeset for help on using the changeset viewer.