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

Task status, heavy write fix and aws ips #322

Merged
merged 8 commits into from
Jan 9, 2022
Merged

Conversation

0x2b3bfa0
Copy link
Member

@0x2b3bfa0 0x2b3bfa0 commented Dec 2, 2021

@0x2b3bfa0 0x2b3bfa0 added enhancement New feature or request ui/ux User interface/experience resource-task iterative_task TF resource labels Dec 2, 2021
@0x2b3bfa0 0x2b3bfa0 self-assigned this Dec 2, 2021
@DavidGOrtega
Copy link
Contributor

I would put all that logic inside tpi stop. That would examine the logs and determine if we are OK, failed, etc...

@DavidGOrtega

This comment has been minimized.

@0x2b3bfa0

This comment has been minimized.

@DavidGOrtega

This comment has been minimized.

@0x2b3bfa0

This comment has been minimized.

@0x2b3bfa0 0x2b3bfa0 requested a review from a team January 7, 2022 17:21
@0x2b3bfa0 0x2b3bfa0 added the p0-critical Max priority (ASAP) label Jan 7, 2022
@0x2b3bfa0
Copy link
Member Author

0x2b3bfa0 commented Jan 7, 2022

Tests

terraform {
  required_providers {
    iterative = {
      source = "github.com/iterative/iterative"
    }
  }
}

provider "iterative" {}

resource "iterative_task" "succeeded" {
  name  = "succeeded"
  cloud = "aws"
  script = "#!/bin/sh\nexit 0"
}

resource "iterative_task" "failed" {
  name  = "failed"
  cloud = "aws"
  script = "#!/bin/sh\nexit 1"
}

resource "iterative_task" "running" {
  name  = "running"
  cloud = "aws"
  script = "#!/bin/sh\nsleep infinity"
}

Results

$ terraform show

# iterative_task.succeeded:
resource "iterative_task" "succeeded" {
    ···
    status          = {
        "running"   = 0
        "succeeded" = 1
    }
}

# iterative_task.failed:
resource "iterative_task" "failed" {
    ···
    status          = {
        "failed"  = 1
        "running" = 0
    }
}

# iterative_task.running:
resource "iterative_task" "running" {
    ···
    status          = {
        "running" = 1
    }
}

@DavidGOrtega
Copy link
Contributor

@0x2b3bfa0 running == 1 is during the whole cycle? I mean... when it starts but not yet running the user's code is running==1?

@0x2b3bfa0
Copy link
Member Author

0x2b3bfa0 commented Jan 7, 2022

Yes, running is about the machine, not about the script. We assume that a running machine will eventually run the user script.

@DavidGOrtega
Copy link
Contributor

Sounds good. A nitpick would be that I prefer one status vs a composed status... but both are equivalent to some extend

😅 It happened because DescribeInstances with
InstanceIds = [] was the same as describing every imaginable
instance in the account.
Copy link
Contributor

@DavidGOrtega DavidGOrtega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fast nitpicks while finishing review

@@ -26,7 +26,9 @@ type Status map[StatusCode]int
type StatusCode string

const (
StatusCodeRunning StatusCode = "running"
StatusCodeActive StatusCode = "running"
StatusCodeSucceeded StatusCode = "succeeded"
Copy link
Contributor

@DavidGOrtega DavidGOrtega Jan 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

success sounds better and a more widely used word in APIs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tell that to Kubernetes developers. 😈 I'm being a bit facetious, of course, and agree that succeeded sounds a bit strange, but it's probably the only grammatically consistent option for that term. 😅

🔔 @casperdcl and your dictionary of synonyms.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it's probably the only grammatically consistent option for that term.

Also success

@0x2b3bfa0
Copy link
Member Author

I prefer one status vs a composed status

How would that “one status” look like? Sounds interesting.

@DavidGOrtega
Copy link
Contributor

DavidGOrtega commented Jan 8, 2022

I prefer one status vs a composed status

How would that “one status” look like? Sounds interesting.

We have already design this previously. As stated in #319
running, terminated, failed and migrating... something like that we defined

It could even be codes like HTTP status codes... so extensible, more at least than two booleans

@DavidGOrtega DavidGOrtega changed the title Add task script status reporting logic status, heavy write and aws ips Jan 8, 2022
@DavidGOrtega DavidGOrtega changed the title status, heavy write and aws ips Task status, heavy write and aws ips Jan 8, 2022
@DavidGOrtega DavidGOrtega changed the title Task status, heavy write and aws ips Task status, heavy write fiix and aws ips Jan 8, 2022
@DavidGOrtega DavidGOrtega changed the title Task status, heavy write fiix and aws ips Task status, heavy write fix and aws ips Jan 8, 2022
@DavidGOrtega
Copy link
Contributor

@DavidGOrtega DavidGOrtega merged commit caa45bb into master Jan 9, 2022
@DavidGOrtega DavidGOrtega deleted the status-reporting branch January 9, 2022 11:08
@0x2b3bfa0 0x2b3bfa0 mentioned this pull request Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p0-critical Max priority (ASAP) resource-task iterative_task TF resource ui/ux User interface/experience
Projects
None yet
3 participants