def task_instance_from_job(job, instance, hostname): instance_context = MesosContext(instance=instance, hostname=hostname) health_check_config = HealthCheckConfig() if job.has_health_check_config(): health_check_config = job.health_check_config() ti = MesosTaskInstance(task=job.task(), role=job.role(), health_check_config=health_check_config, instance=instance) if job.has_announce(): ti = ti(announce=job.announce()) if job.has_environment(): ti = ti(environment=job.environment()) if job.has_lifecycle(): ti = ti(lifecycle=job.lifecycle()) return ti.bind(mesos=instance_context)
def task_instance_from_job(job, instance): instance_context = MesosContext(instance=instance) # TODO(Sathya): Remove health_check_interval_secs references after deprecation cycle is complete. health_check_config = HealthCheckConfig() if job.has_health_check_interval_secs(): health_check_config = HealthCheckConfig(interval_secs=job.health_check_interval_secs().get()) elif job.has_health_check_config(): health_check_config = job.health_check_config() ti = MesosTaskInstance(task=job.task(), role=job.role(), health_check_interval_secs=health_check_config.interval_secs().get(), health_check_config=health_check_config, instance=instance) if job.has_announce(): ti = ti(announce=job.announce()) if job.has_environment(): ti = ti(environment=job.environment()) return ti.bind(mesos=instance_context).interpolate()
def task_instance_from_job(job, instance): instance_context = MesosContext(instance=instance) # TODO(Sathya): Remove health_check_interval_secs references after deprecation cycle is complete. health_check_config = HealthCheckConfig() if job.has_health_check_interval_secs(): health_check_config = HealthCheckConfig( interval_secs=job.health_check_interval_secs().get()) elif job.has_health_check_config(): health_check_config = job.health_check_config() ti = MesosTaskInstance( task=job.task(), role=job.role(), health_check_interval_secs=health_check_config.interval_secs().get(), health_check_config=health_check_config, instance=instance) if job.has_announce(): ti = ti(announce=job.announce()) if job.has_environment(): ti = ti(environment=job.environment()) return ti.bind(mesos=instance_context).interpolate()