This is no longer necessary now that dbomatic replays events. It was also causing maintenance difficulties in that we would have to parse the XML in two different places (once in dbomatic and once in condormatic), which we were forgetting to do. Just remove it completely, and rely on the replay to handle events that we haven't consumed yet.
Signed-off-by: Chris Lalancette <[email protected]> --- src/app/util/condormatic.rb | 40 ---------------------------------------- src/dbomatic/dbomatic | 7 ------- 2 files changed, 0 insertions(+), 47 deletions(-) diff --git a/src/app/util/condormatic.rb b/src/app/util/condormatic.rb index bcb8764..ea18308 100644 --- a/src/app/util/condormatic.rb +++ b/src/app/util/condormatic.rb @@ -115,46 +115,6 @@ def condor_to_instance_state(state_val) end end -def condormatic_instances_sync_states - - begin - # I'm not going to do the 2&>1 trick here since we are parsing the output - # and I'm afraid we'll get a warning or something on stderr and it'll mess - # up the xml parsing. - pipe = IO.popen("condor_q -xml") - xml = pipe.read - pipe.close - - raise ("Error calling condor_q -xml") if $? != 0 - - doc = Nokogiri::XML(xml) - jobs_state = {} - jobs_error_msg = {} - doc.xpath('/classads/c').each do |jobs| - job_hold_reason = (v = jobs.at_xpath('./a...@n="HoldReason"]/s')) ? v.text : nil - job_name = (v = jobs.at_xpath('./a...@n="Cmd"]/s')) ? v.text : nil - job_state= (v = jobs.at_xpath('./a...@n="JobStatus"]/i')) ? v.text : nil - - Rails.logger.info "job name is #{job_name}" - Rails.logger.info "job state is #{job_state}" - Rails.logger.info "hold reason is #{job_hold_reason}" - - jobs_state[job_name] = condor_to_instance_state(job_state) if job_name - jobs_error_msg[job_name] = job_hold_reason if job_hold_reason - end - - Instance.find(:all).each do |instance| - instance.last_error = jobs_error_msg[instance.condor_job_id] if jobs_error_msg.has_key?(instance.condor_job_id) - instance.state = jobs_state[instance.condor_job_id] || Instance::STATE_STOPPED - instance.save! - Rails.logger.info "Instance state updated to #{instance.state}" - end - rescue Exception => ex - Rails.logger.error ex.message - Rails.logger.error ex.backtrace - end -end - def condormatic_instance_stop(task) instance = task.instance_of?(InstanceTask) ? task.instance : task diff --git a/src/dbomatic/dbomatic b/src/dbomatic/dbomatic index 562da34..d52f655 100755 --- a/src/dbomatic/dbomatic +++ b/src/dbomatic/dbomatic @@ -263,13 +263,6 @@ begin # Create one for parsing purposes. parser << "<events>" - # sync up the states that condor knows about with what is in the aggregator - # database. Note that there is still a chance that the state is changing - # internally to condor while we are syncing the states here. However, condor - # will emit an event in that case, so it will be taken care of by the - # EventLog parsing later on. - condormatic_instances_sync_states - notifier = INotify::Notifier.new log_file = nil -- 1.7.3.1 _______________________________________________ deltacloud-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/deltacloud-devel
