-
Notifications
You must be signed in to change notification settings - Fork 241
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
validate dependent jobs' parents - issue 148 #245
validate dependent jobs' parents - issue 148 #245
Conversation
@@ -205,16 +207,27 @@ def validate_chronos(service_path): | |||
service=service, clusters=[cluster], instance_type=instance_type, | |||
soa_dir=soa_dir): | |||
cjc = load_chronos_job_config(service, instance, cluster, False, soa_dir) | |||
checks_passed, check_msgs = cjc.validate() | |||
cjcs[service + '.' + cjc.get_job_name()] = cjc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a little more complicated than I think it needs to be. While not super efficient, can it just be:
for parent in get_parents()
if parent not in get_services_for_cluster(cluster=cluster, instance_type=chronos):
# something
…path that uses it #148
@@ -201,12 +203,25 @@ def validate_chronos(service_path): | |||
|
|||
returncode = True | |||
for cluster in list_clusters(service, soa_dir, instance_type): | |||
services_in_cluster = get_services_for_cluster(cluster=cluster, instance_type='chronos') | |||
valid_services = set([name + '.' + instance for name, instance in services_in_cluster]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"%s%s%s" % (service, ".", instance)
lgtm |
fix n ship |
…sue-148 validate dependent jobs' parents - issue 148
This should fix #148 .
Catches two types of config errors:
service_name.instance_name
). Similar to what the JSON schema also enforces.Note that the second validation won't let a "
ServiceA
child" depend on a "ServiceB
parent". That's the best we can do without parsing the entireyelpsoa-configs
tree.In my opinion
paasta_tools/cli/cmds/validate.py
, in order to validate the Chronos config, needs to know too many details aboutChronosJobConfig
. If need be, I'm happy to move as much of that logic intopaasta_tools/chronos_tools.py
as possible, so that the latter is in charge of the validation and the former just prints out the outcome.