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

feat(edge-compute): move host jobs to edge #3840

Merged
merged 84 commits into from
Jun 25, 2020

Conversation

chiptus
Copy link
Contributor

@chiptus chiptus commented May 20, 2020

fix #3745

@chiptus chiptus added the work-in-progress Indicates that the PR is a work-in-progress and not ready yet label May 20, 2020
@chiptus chiptus requested a review from deviantony May 20, 2020 16:55
@chiptus chiptus changed the base branch from develop to 2.0 May 20, 2020 16:55
Copy link
Member

@deviantony deviantony left a comment

Choose a reason for hiding this comment

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

Few things I noticed while trying this build:

  • Cannot start from a clean environment, I get the following error in the Portainer logs:
2020/05/21 06:38:40 [ERROR] [http,client] [message: unexpected status code] [status_code: 403]
2020/05/21 06:38:40 [WARN] [exec,extensions] [message: unable to retrieve extensions manifest via Internet. Extensions will be retrieved from local cache and might not be up to date] [err: Invalid response status (expecting 200)]
2020/05/21 06:38:40 [WARN] [exec,extensions] [message: unable to retrieve extension information from Internet. Skipping extensions update check.] [err: open /extensions.json: no such file or directory]
2020/05/21 06:38:40 time: invalid duration 

I believe that the problem here is:

2020/05/21 06:38:40 time: invalid duration

If I then start a 2.0.0-dev instance before trying to run this implementation with the same database, it starts fine.

  • UI - Settings - Change the tooltip of the Host management switch to:
    "Enable host management features: host system browsing and advanced host details." (I just added advanced)

Remove the part about CAP_HOST_MANAGEMENT.

  • Sidebar looks broken, I only logged in and I can see endpoint level links in the home view.

Portainer - 2020-05-21T184302 172

  • In the Edge job creation view, when no Edge endpoints are available the selector display a "loading" message. It should display "No endpoint available".

Portainer - 2020-05-21T184452 983

After creating an Edge endpoint, it still displays loading so I can't select any endpoint.

  • We should prevent the creation of an Edge job if the script file is empty or if there is no associated endpoint

Portainer - 2020-05-21T184820 697

I wasn't able to dig more into this due to the impossibility to create an Edge job at the moment.

@chiptus chiptus force-pushed the feat3745-move-host-jobs-to-edge branch from c524a07 to e2afaad Compare May 21, 2020 08:31
Copy link
Contributor Author

@chiptus chiptus left a comment

Choose a reason for hiding this comment

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

fixes

app/edge/components/group-form/groupFormController.js Outdated Show resolved Hide resolved
app/edge/services/edge-job.js Outdated Show resolved Hide resolved
@chiptus chiptus requested a review from deviantony May 24, 2020 05:38
@chiptus chiptus removed the work-in-progress Indicates that the PR is a work-in-progress and not ready yet label May 24, 2020
Copy link
Member

@deviantony deviantony left a comment

Choose a reason for hiding this comment

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

  • Review the task panel in the Edge job details view to only keep the tasks datatable

Portainer - 2020-05-26T172130 290

This datatable should only have two columns: Endpoint, Actions

In the Endpoint column, keep the name of the associated endpoint.

In the actions column, introduce a new way to collect logs via the "Retrieve logs" action. When the logs are available (upon refresh of the view), this action should then change to "Download logs".

  • Introduce support for collecting logs associated to a task

Related agent issue: portainer/agent#135

@chiptus
Copy link
Contributor Author

chiptus commented May 27, 2020

  • Introduce a new action that can be used to clear the associated logs for each selected Edge job

I think my suggestion was misunderstood. What I was thinking was to add the batch action to the task table. There we can have collect logs, clear logs. Download logs will be separate for each task.

@chiptus chiptus force-pushed the feat3745-move-host-jobs-to-edge branch from 64fb8ee to c4fe751 Compare May 27, 2020 12:22
@chiptus
Copy link
Contributor Author

chiptus commented May 27, 2020

  • persist (in DB) which job/endpoint logs are required
  • send them in endpoint_status_inspect, each job with a collectLogs boolean
  • add an API route POST /endpoint/:endpoint_id/edge/jobs/:edge_job_id/logs to get logs. this API will cache logs, and set log collection status as received (endpoint should be "edge" secured)
  • GET /endpoint/:endpoint_id/edge/jobs/:edge_job_id/logs to get the logs (admin access)

suggestion:

  • replace edgeJob.endpoints from an array of ids to an array of objects {endpointId:int, logsStatus:nil/pending/received}
  • edgeSchedule (the response object sent to an edge endpoint) - remove endpoints array, I'm pretty sure it's redundant and add collectLogsBoolean based on job.endpoints[endpointId].logsStatus

@chiptus chiptus force-pushed the feat3745-move-host-jobs-to-edge branch from cf45858 to 5656986 Compare June 1, 2020 09:48
@chiptus chiptus requested a review from deviantony June 2, 2020 14:32
@deviantony deviantony changed the base branch from 2.0 to develop June 2, 2020 23:42
@deviantony deviantony added the rebase-required Indicates that the PR must be rebased on the latest development branch label Jun 2, 2020
@deviantony
Copy link
Member

Please rebase that PR on the develop branch.

@chiptus chiptus force-pushed the feat3745-move-host-jobs-to-edge branch from c6780c2 to 55ef5d5 Compare June 3, 2020 05:07
@pull-dog
Copy link

pull-dog bot commented Jun 3, 2020

*Ruff* 🐶 The test environment for this pull request has been destroyed 💥 This may have happened explicitly via a command, or because the pull request was closed.

React on this comment to leave anonymous feedback.

  • 👍 to say good dog 🍖
  • 👎 to say bad dog 🦴
Commands
  • @pull-dog up to reprovision or provision the server.
  • @pull-dog down to delete the provisioned server.

@chiptus chiptus force-pushed the feat3745-move-host-jobs-to-edge branch from 55ef5d5 to 302c38b Compare June 4, 2020 06:41
@deviantony deviantony removed the rebase-required Indicates that the PR must be rebased on the latest development branch label Jun 4, 2020
@chiptus chiptus force-pushed the feat3745-move-host-jobs-to-edge branch from c2d319b to a946a21 Compare June 4, 2020 11:25
Copy link
Member

@deviantony deviantony left a comment

Choose a reason for hiding this comment

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

  • It seems that this version is not working with Edge stacks, I created an Edge stack but it stayed in Pending state for my Edge endpoint (agent running the following implementation feat(edge-jobs): collect logs agent#140)

  • There is a problem with the schedule date associated to an Edge job, in the following picture I created an Edge job that should start at 4.45 and when I inspect it the associated schedule date is set to 4.42 (current time of my machine)

Portainer - 2020-06-05T164202 128

Portainer - 2020-06-05T164214 881

  • Rename Tasks to Results

Portainer - 2020-06-05T165055 088

  • After succesfully downloading the logs, it should automatically clear the logs

@chiptus
Copy link
Contributor Author

chiptus commented Jun 7, 2020

  • t seems that this version is not working with Edge stacks, I created an Edge stack but it stayed in Pending state for my Edge endpoint (agent running the following implementation portainer/agent#140)

which endpoint was it? running on the vagrant setup everything worked as expected. running on a local agent (non swarm), it stayed in pending, but that's expected because the endpoint can't run stacks

@chiptus
Copy link
Contributor Author

chiptus commented Jun 7, 2020

  • After succesfully downloading the logs, it should automatically clear the logs

it seems like FileSaver doesn't return a promise, so there's no way to understand if the file was downloaded

@ncresswell
Copy link
Member

ncresswell commented Jun 7, 2020 via email

@chiptus
Copy link
Contributor Author

chiptus commented Jun 7, 2020

  • There is a problem with the schedule date associated to an Edge job, in the following picture I created an Edge job that should start at 4.45 and when I inspect it the associated schedule date is set to 4.42 (current time of my machine)

what do you mean inspect it? I got the corn job set at the same time I set in the form. The problem I saw is that when submitting the cron expression I ss prefixed with "0 " thus making it not valid in Linux (which expects 5 places, not 6, as far as I understand). fixing it made the job run in the time I assigned it

@deviantony
Copy link
Member

Been testing this again.

There is a problem with the schedule date associated to an Edge job, in the following picture I created an Edge job that should start at 4.45 and when I inspect it the associated schedule date is set to 4.42 (current time of my machine)

Cannot reproduce this one.

It seems that this version is not working with Edge stacks, I created an Edge stack but it stayed in Pending state for my Edge endpoint (agent running the following implementation portainer/agent#140)

Cannot reproduce this one.

After succesfully downloading the logs, it should automatically clear the logs

Ignore this for now.

@chiptus chiptus force-pushed the feat3745-move-host-jobs-to-edge branch from 0ce78b8 to 24d122d Compare June 22, 2020 07:40
Copy link
Member

@deviantony deviantony left a comment

Choose a reason for hiding this comment

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

@ncresswell can you validate host jobs migration? Migrating from an instance with host jobs defined to this new version.

@chiptus have a look at my comments, have some questions as well as some suggestions.

api/bolt/migrator/migrator.go Outdated Show resolved Hide resolved
api/http/handler/edgejobs/edgejob_inspect.go Outdated Show resolved Hide resolved
api/http/handler/endpoints/endpoint_status_inspect.go Outdated Show resolved Hide resolved
api/http/handler/edgejobtasks/handler.go Outdated Show resolved Hide resolved
api/http/handler/handler.go Outdated Show resolved Hide resolved
api/internal/snapshot/snapshot.go Outdated Show resolved Hide resolved
api/internal/snapshot/snapshot.go Show resolved Hide resolved
api/portainer.go Show resolved Hide resolved
api/portainer.go Show resolved Hide resolved
@ncresswell
Copy link
Member

ncresswell commented Jun 22, 2020 via email

@deviantony
Copy link
Member

@chiptus this probably requires a fix

@chiptus chiptus requested a review from deviantony June 24, 2020 08:58
@deviantony
Copy link
Member

@pull-dog down

Copy link
Member

@deviantony deviantony left a comment

Choose a reason for hiding this comment

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

One minor change required, LGTM

api/bolt/migrator/migrator.go Outdated Show resolved Hide resolved
Copy link
Member

@deviantony deviantony left a comment

Choose a reason for hiding this comment

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

Took care of removing the unused dependency, LGTM

@deviantony
Copy link
Member

Build is OK, CI is failing cause free plan !

@deviantony deviantony merged commit 24528ec into develop Jun 25, 2020
@deviantony deviantony deleted the feat3745-move-host-jobs-to-edge branch June 25, 2020 03:25
chiptus pushed a commit to chiptus/portainer that referenced this pull request Dec 17, 2023
fix(edgeconfigs): add triggers for endpoint groups EE-5417
fix(edgeconfigs): fix wrong progress counts EE-4517
fix(edgeconfigs): push missing delete command for async EE-5417
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Host jobs an Edge exclusive feature
3 participants