Commit Graph
100 Commits
Author SHA1 Message Date
Chris Meyers 4ab4f2f8f9 add missing imports 2020-12-01 08:40:18 -05:00
Chris Meyers d8ca3ba894 fix flake8 2020-11-02 15:45:16 -05:00
Chris Meyers eb47c8dbc6 centralize reusable profiling code 2020-10-27 08:21:41 -04:00
Chris Meyers 79d7c6d9b3 make optimization code work with container groups
* Task manager fit_ optimization code caused problems with container
group code.
* Note that we don't actually get the benefit of the optimization for
container groups. We just make it so that the code doesn't blow up. It
will take another pass to apply optimizations to the container group
task manager path.
2020-10-23 10:17:30 -04:00
Chris Meyers ce052922c6 terminal graph of job status changes
* Visualize how jobs go from pending, waiting, running over time
2020-10-23 10:15:32 -04:00
Chris Meyers 84cb7be079 fill in postgres application_name on connection
* Tried to fill in application_name in awx/__init__.py but I think that
is too late
* Fill in database application_name with enough information to easily
trace the connection from postgres back to the node and pid that
initiated the connection.
* Set application_name in django settings so that application_name is
set _before_ the first postgres connection is established.
2020-10-20 08:32:09 -04:00
Chris Meyers 11cc6362b5 reduce per-job database query count
* Do not query the database for the set of Instance that belong to the
group for which we are trying to fit a job on, for each job.
* Instead, cache the set of instances per-instance group.
2020-10-19 11:01:11 -04:00
Chris Meyers bdabe36029 reduce parent->child lock contention
* We update the parent unified job template to point at new jobs
created. We also update a similar foreign key when the job finishes
running. This causes lock contention when the job template is
allow_simultaneous and there are a lot of jobs from that job template
running in parallel. I've seen as bad as 5 minutes waiting for the lock
when a job finishes.
* This change moves the parent->child update to OUTSIDE of the
transaction if the job is allow_simultaneous (inherited from the parent
unified job). We sacrafice a bit of correctness for performance. The
logic is, if you are launching 1,000 parallel jobs do you really care
that the job template contains a pointer to the last one you launched?
Probably not. If you do, you can always query jobs related to the job
template sorted by created time.
2020-10-19 11:01:05 -04:00
Chris Meyers 2eac5a8873 reduce per-job database query count
* Do not query the database for the set of Instance that belong to the
group for which we are trying to fit a job on, for each job.
* Instead, cache the set of instances per-instance group.
2020-10-19 10:54:56 -04:00
Chris Meyers 09a0448c3e reduce parent->child lock contention
* We update the parent unified job template to point at new jobs
created. We also update a similar foreign key when the job finishes
running. This causes lock contention when the job template is
allow_simultaneous and there are a lot of jobs from that job template
running in parallel. I've seen as bad as 5 minutes waiting for the lock
when a job finishes.
* This change moves the parent->child update to OUTSIDE of the
transaction if the job is allow_simultaneous (inherited from the parent
unified job). We sacrafice a bit of correctness for performance. The
logic is, if you are launching 1,000 parallel jobs do you really care
that the job template contains a pointer to the last one you launched?
Probably not. If you do, you can always query jobs related to the job
template sorted by created time.
2020-10-19 10:54:51 -04:00
Chris Meyers 924273f589 more get_ansible_version test failure fixes 2020-09-01 12:50:59 -04:00
Chris Meyers 72fc314da1 flake8 fix 2020-09-01 12:50:59 -04:00
Chris Meyers 043a7f8599 more get_ansible_version removal 2020-09-01 12:50:59 -04:00
Chris Meyers a6712cfd60 bump inv plugin migration to avoid conflict 2020-09-01 12:50:59 -04:00
Chris Meyers 03ad1aa141 remove backwords migraiton support for inv plugins
* Do not write out inventory source_vars to a file on disk as they _may_
contain sensitive information. This also removes support for backwards
migrations. This is fine, backwards migration is really only useful
during development.
2020-09-01 12:50:59 -04:00
Chris Meyers a9cdf07690 push global invsource fields onto invsource obj 2020-09-01 12:50:58 -04:00
Chris Meyers d518891520 inventory plugin inventory parameter take precedence over env vars 2020-09-01 12:50:58 -04:00
Chris Meyers 48fb1e973c overwrite plugin: at runtime
* Before, we were re-writing `plugin:` when users updated the
InventorySource via the API. Now, we just override at run-time. This
makes for a more sane API interaction
2020-09-01 12:50:58 -04:00
Chris Meyers c7794fc3e4 fix missed import 2020-09-01 12:50:58 -04:00
Chris Meyers 12cf607e8a simplify InventorySourceOption inheritance hack 2020-09-01 12:50:58 -04:00
Chris Meyers 7d4493e109 rename inventory migration 2020-09-01 12:50:57 -04:00
Chris Meyers 2eec1317bd safer migrations 2020-09-01 12:50:57 -04:00
Chris Meyers b7efad5640 do not enforce plugin: for source=scm
* InventorySource w/ source type scm point to an inventory file via
source_file. source_vars are ignored.
2020-09-01 12:50:57 -04:00
Chris Meyers 35d264d7f8 forgot to add migration helper
* move models/inventory.py plugin injector logic to a place frozen in
time useable by the migration code.
2020-09-01 12:50:57 -04:00
Chris Meyers 34adbe6028 fix tests for new inv plugin behavior
* Enforce plugin:
2020-09-01 12:50:57 -04:00
Chris Meyers a8a47f314e remove source_regions 2020-09-01 12:50:56 -04:00
Chris Meyers f32716a0f1 remove instance_filter 2020-09-01 12:50:56 -04:00
Chris Meyers 7278e7c025 remove group_by from inventory source
* Does not remove group_by testing
2020-09-01 12:50:56 -04:00
Chris Meyers e11040f421 migrate to new style inv plugin 2020-09-01 12:50:53 -04:00
chris meyers 2f7ba75ae4 track stats by hostname not remote host/ip
* broadcast websockets have stats tracked (i.e. connection status,
number of messages total, messages per minute, etc). Previous to this
change, stats were tracked by ip address, if it was defined on the
instance, XOR hostname. This changeset tracks stats by hostname.
2020-06-08 16:35:17 -04:00
chris meyers 9c20b9412a delete and re-add host when ip address changes
* The websocket backplane interconnect is done via ip address for
Kubernetes and OpenShift. On init run_wsbroadcast reads all Instances
from the DB and makes a decision to use the ip address or the hostname
based, with preference given to the ip address if defined. For
Kubernetes and OpenShift the nodes can load the Instance before the
ip_address is set. This would cause the connection to be tried by
hostname rather than ip address. This changeset ensures that an ip
address set after an Instance record is created will be detected and
used.
2020-06-08 16:34:51 -04:00
chris meyers 8bf426479c fix schema check
* Not sure how or when, but ours crawling tests set the cluster node id
to NOT start with `awx-`. That is fine, the schema checker just needs to
account for that.
2020-05-13 14:39:26 -04:00
chris meyers 155faa0138 delete and re-add host when ip address changes
* The websocket backplane interconnect is done via ip address for
Kubernetes and OpenShift. On init run_wsbroadcast reads all Instances
from the DB and makes a decision to use the ip address or the hostname
based, with preference given to the ip address if defined. For
Kubernetes and OpenShift the nodes can load the Instance before the
ip_address is set. This would cause the connection to be tried by
hostname rather than ip address. This changeset ensures that an ip
address set after an Instance record is created will be detected and
used.
2020-05-13 14:12:07 -04:00
chris meyers 90c02db386 track stats by hostname not remote host/ip
* broadcast websockets have stats tracked (i.e. connection status,
number of messages total, messages per minute, etc). Previous to this
change, stats were tracked by ip address, if it was defined on the
instance, XOR hostname. This changeset tracks stats by hostname.
2020-05-13 09:47:37 -04:00
chris meyers 216454d298 cleanup channel groups on start
* There are 2 data-structures that django channels redis uses: (1) zset
and (2) list. (1) is used for group membership where the key is the
logic user group and the value(s) are websocket clients. The score of
the zset entry is used for group expiration. We can not rely on group
expiration for clean-up because there is no interface privided by redis
channels to refresh the expiration. Choosing a small value for
group_expiry could result on our websocket backplane group expiring,
which would result in job events not being delivered. Instead, we
increase the group expiration to 5 years and clean up on daphne service
start.
* The list (2) data-structure is used by django channels redis to queue
websocket events per-websocket-client as needed. The need arises to
queue per-websocket-client events when the consumer can not keep up with
the producer. The consumer here is daphne, the producer is AWX.
* When AWX is operating healthy group membership in Redis is reflective
of the real-world. When AWX is unhealthy i.e. daphne cycles, the zset
will contain stale websocket client entries. This can be observed by
running `zrange asgi::group:jobs-status_changed 0 -1`. If the entries
returned look like:
specific.fUkXXpYj!DKOIfwPICNgw
specific.fUkXXpYj!FQcdopZeiRdG
specific.lpTSAgnk!IOKldfzcfdDp
specific.lpTSAgnk!NbvRUZsDpIQx
The entries with `fUkXXpYj` are stale. Note that this changeset fixes
this by removing all `asgi:*` entries on daphne start.
* Also note that individual message themselves have an expiration that
is configurable and defaults to 60.
* Also note that zset's tracking group membership will be deleted by
django channels redis when they are empty.
2020-05-11 11:02:57 -04:00
chris meyers ba7e2c9bc4 missing f"" on log statement 2020-05-04 15:57:56 -04:00
chris meyers 503b86d41c remove memcached based fact caching plugin
* AWX uses the JSON fact caching module that ships with Ansible
2020-05-04 09:28:21 -04:00
chris meyers a8f52c1639 actually do exponential calc rather than *2
* Log the time til reconnect attemp to log message rather than attempt
number
2020-04-28 15:24:08 -04:00
chris meyers 2ecd055d1e sleep backoff on cb receiver reconnect
* Sleep before trying to reconnect
Most common reason for entering this reconnect loop is when Redis
service stops before the callback receiver when stopping tower services.
2020-04-28 12:47:40 -04:00
chris meyers 960aa9df16 add redis logs to sosreport
* rhel8 /var/log/redis/redis.log
* rhel7 scl location
2020-04-28 09:12:42 -04:00
chris meyers ac46013fcc fix sliding window per/minute calc
* Add tests to ensure correctness
2020-04-24 15:55:11 -04:00
chris meyers 01c56a4f2b lie about last time analytics were collected
* Ensure that everything that we put into the database is returned via
analytics.
2020-04-22 14:10:45 -04:00
chris meyers 921feb561d add test case for wfj nodes analytics 2020-04-21 20:21:38 +02:00
chris meyers 8592bf3e39 better broadcast websocket logging
* Make quiter the daphne logs by raising the level to INFO instead of
DEBUG
* Output the django channels name of broadcast clients. This way, if the
queue gets backed up, we can find it in redis.
2020-04-17 17:19:08 -04:00
chris meyers 4787e69afb consistent wsbroadcast log messages 2020-04-17 17:18:21 -04:00
chris meyers fd068695ef cleanup group membership on disconnect
* zcard asgi::group:jobs-status_changed <-- to see a group set that
continues to grow. Issue this command in a loop while refreshing the
browser page on the jobs list. Before this change the set size would
continue to grow as daphne channel names are added to the group. After
this change the set size stays stable at the expected, 1.
2020-04-17 13:16:11 -04:00
chris meyers 72248db76d fix copy paste error in docker compose cluster 2020-04-16 14:12:30 -04:00
chris meyers d30ecb6fb3 confidence in websocket group logic is high
* Replying to websocket group membership with the previous state, delta,
and new state has shown to be quite stable. This debug message is not
very helpful and is noisy in the dev env. This change removes the debug
message.
2020-04-16 08:48:12 -04:00
chris meyers 7f01de26a1 reconnect when a vanilla server disconnect happens 2020-04-15 19:02:33 -04:00
chris meyers 1acca459ef nice error message when redis is down
* awx_manage run_wsbroadcast --status nice error message if someone
failed to start awx services (i.e. redis)
2020-04-15 13:28:13 -04:00
chris meyers 63f56d33aa show user unsafe name
* We log stats using a safe hostname because of prometheus requirements.
However, when we display users the hostname we should use the Instance
hostname. This change outputs the Instance.hostname instead of the safe
prometheus name.
2020-04-14 16:59:34 -04:00
chris meyers 9cabf3ef4d do not include iso nodes in wsbroadcast status 2020-04-14 16:55:56 -04:00
chris meyers daa312d7ee log file for wsbroadcast 2020-04-14 14:21:23 -04:00
chris meyers ee18400a33 ensure last comma removed in select
* We strip out the json select fields in our tests since it is an sql
lite database underneath. Ideally, we would do something fancier, but we
aren't. In doing this stipping, we could strip the last element in the
projection list. This would result in an extra dangling comma. This
commit removes the danging comma in the projection list after the
removal of JSON projections.
2020-04-14 10:44:02 -04:00
chris meyers 9c6e42fd1b fix spelling mistake in wsbroadcast status output 2020-04-13 09:37:32 -04:00
chris meyers 1f9f86974a test analytics table output
* unified_jobs output should include derived jobs i.e. project update,
inventory update, job
* This PR adds a test to ensure that.
2020-04-09 15:20:27 +02:00
chris meyers c4d704bee1 fix memcached in dev env
* create memcached dir via git so that the current user owns it.
Otherwise, docker will create the dir as root at runtime
2020-04-06 16:35:52 -04:00
chris meyers c06188da56 align with openshift 2020-04-06 09:16:46 -04:00
chris meyers 7433aab258 switch memcached from tcp to unix domain socket 2020-04-06 08:35:12 -04:00
chris meyers 37a715c680 use memcached unix domain socket rather than tcp 2020-04-06 08:35:12 -04:00
chris meyers 3d9eb3b600 align with openshift 2020-04-05 20:07:15 -04:00
chris meyers a26df3135b static identifier in docs
* OPTIONS response descritpion for workflow job template node identifier
value was an ever changing uuid4(). This is telling the user the wrong
thing. We can not know what uuid4() is going to be in the docs. Instead,
for the OPTIONS response description, tell the user the form that the
uuid4() takes, ie. xxx-xxxx...
* Note that the API browser still populates a uuid4 for the user when it
generates the sample POST data. This is nice.
2020-04-03 13:12:49 -04:00
chris meyers d7f0642f48 add ws broadcast status to sos report 2020-04-02 21:46:12 -04:00
chris meyers 8bbae0cc3a color output of ws broadcast connection status 2020-04-02 21:46:12 -04:00
chris meyers c00f1505d7 add broadcast websocket status command 2020-04-02 21:46:12 -04:00
chris meyers 6d0c42a91a align with configmap changes 2020-04-02 20:05:26 -04:00
chris meyers 79c5a62279 simplify nonce creation and extraction
* time() library supports leap seconds also
2020-04-02 19:57:50 -04:00
chris meyers 6d60e7dadc align with openshift 2020-04-02 13:56:33 -04:00
chris meyers 929f4bfb81 start redis container with conf file 2020-04-02 11:13:35 -04:00
chris meyers 3326979806 fix register_queue race conditionn
* Avoid race condition with `apply_cluster_membership_policies`
2020-03-27 16:15:10 -04:00
chris meyers eab74cac07 autogenerate websocket secret 2020-03-26 10:32:37 -04:00
chris meyers 5ba90b629e fixup dev cluster bringup
* change from bootstrap script to launch_awx.sh script
2020-03-23 07:33:35 -04:00
chris meyers e9021bd173 serialize register_queue
* also remove uneeded query
2020-03-23 07:21:17 -04:00
chris meyers 47f5c17b56 log when notifications fail to send
* If a job does not finish in the 5 second timeout. Let the user know
that we failed to even try to send the notification.
2020-03-20 09:11:01 -04:00
chris meyers 06f065766f remove BROKER_URL special password handling
* BROKER_URL now describes how to connect to redis. We use a unix socket
to connect to redis. Therefore, no longer need to support fancy uri's
that contain fancy characters in the password.
2020-03-19 15:12:45 -04:00
chris meyers 0e70543d54 licenses for new python deps 2020-03-19 14:44:29 -04:00
chris meyers fd56b7c590 pin pexpect to 4.7.0 2020-03-19 11:25:43 -04:00
chris meyers 7f02e64a0d fix redis requirements mess
* Add the end of the redis PR we rebased devel a bunch. requirements
snuck into requirements.txt this way. This PR removes those requirements
(i.e. kombu) and bumps other requirements.
2020-03-19 10:19:07 -04:00
chris meyers 5e481341bc flake8 2020-03-19 10:01:20 -04:00
chris meyers 0a1070834d only update the ip address field on the instance
* The heartbeat of an instance is determined to be the last modified
time of the Instance object. Therefore, we want to be careful to only
update very specific fields of the Instance object.
2020-03-19 10:01:20 -04:00
chris meyers c7de3b0528 fix spelling 2020-03-19 10:01:20 -04:00
chris meyers 7f2e1d46bc replace janky unique channel name w/ uuid
* postgres notify/listen channel names have size limitations as well as
character limitations. Respect those limitations while at the same time
generate a unique channel name.
2020-03-19 08:59:15 -04:00
chris meyers 12158bdcba remove dead code 2020-03-19 08:57:05 -04:00
chris meyers 87de0cf0b3 flake8, pytest, license fixes 2020-03-18 16:10:20 -04:00
chris meyers 18f5dd6e04 add websocket backplane documentation 2020-03-18 16:10:20 -04:00
chris meyers 89163f2915 remove redis broker url test
* We use sockets everywhere. Thus, password special characters no longer
are an issue.
2020-03-18 16:10:20 -04:00
chris meyers 59c9de2761 awxkit python2.7 compatible print
* awxkit still supports python2.7 so do not use fancy f"" yet; instead,
use .format()
2020-03-18 16:10:20 -04:00
chris meyers b58c71bb74 remove broadcast websockets view 2020-03-18 16:10:20 -04:00
chris meyers 770b457430 redis socket support 2020-03-18 16:10:19 -04:00
chris meyers d58df0f34a fix sliding window calculation 2020-03-18 16:10:19 -04:00
chris meyers 3f5e2a3cd3 try to make openshift build happy 2020-03-18 16:10:19 -04:00
chris meyers 2b59af3808 safely operate in async or sync context 2020-03-18 16:10:19 -04:00
chris meyers 9e5fe7f5c6 translate Instance hostname to safe analytics name
* More robust translation of Instance hostname to analytics safe name by
replacing all non-alpha numeric characters with _
2020-03-18 16:10:19 -04:00
chris meyers 093d204d19 fix flake8 2020-03-18 16:10:19 -04:00
chris meyers e25bd931a1 change dispatcher test to make required queue
* No fallback-default queue anymore. Queue must be explicitly provided.
2020-03-18 16:10:19 -04:00
chris meyers 8350bb3371 robust broadcast websocket error hanndling 2020-03-18 16:10:18 -04:00
chris meyers d6594ab602 add broadcast websocket metrics
* Gather brroadcast websocket metrics and push them into redis every
configurable seconds.
* Pop metrics from redis in web view layer to display via the api on
demand
2020-03-18 16:10:18 -04:00
chris meyers b6b9802f9e increase per-channel capacity
* 100 is the default capacity for a channel. If the client doesn't read
the socket fast enough, websocket messages can and will be lost. This
increases the default to 10,000
2020-03-18 16:10:18 -04:00
chris meyers 0da94ada2b add missing service name to dev env
* Dev env was bringing the wsbroadcast service up but not under the
tower-process dependency. This is cleaner.
2020-03-18 16:10:18 -04:00
chris meyers 3b9e67ed1b remove channel group model
* Websocket user session <-> group subscription membership now resides
in Redis rather than the database.
2020-03-18 16:10:18 -04:00