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

Edit JSON button does not work with empty/missing schema #18

Closed
pjockey opened this issue Jun 12, 2021 · 15 comments
Closed

Edit JSON button does not work with empty/missing schema #18

pjockey opened this issue Jun 12, 2021 · 15 comments

Comments

@pjockey
Copy link

pjockey commented Jun 12, 2021

Just ran the update process and when the website loads I get the error above. The Supervisor website loads and the boards attached it start up and function.

[2021-06-12 12:42:16 -0600] [2793] [INFO] Booting worker with pid: 2793
[2021-06-12 12:42:46 -0600] [2457] [CRITICAL] WORKER TIMEOUT (pid:2793)
[2021-06-12 12:42:46 -0600] [2793] [INFO] Worker exiting (pid: 2793)

This is the output of the Terminal.

@sflems
Copy link
Owner

sflems commented Jun 12, 2021

It's just the status monitor that's reporting the incorrect status correct?

If you activate a different profile does the status return? There has been a ghost issue where the GUI gets out of sync with supervisor and this usually resolves it.

I'll look into changing the method that the GUI uses to check the status.

Let me know if that works as a hotfix for now, else we'll look at a few other culprits.

@pjockey
Copy link
Author

pjockey commented Jun 13, 2021

I stopped the board from displaying the MLB from IP address:9001. Then start the led-board-manager at IP addres:9002 and received the attached image
Screen Shot 2021-06-13 at 10 30 43

The screen shows the game today, still shows the supervisor not running, and nothing on the board.

The code below shows the output of the RPi.

pi@raspberrypi:~/led-board-manager $ source env/bin/activate && gunicorn Capstone.wsgi -b 192.168.1.175:9002
[2021-06-13 10:26:46 -0600] [16956] [INFO] Starting gunicorn 20.0.4
[2021-06-13 10:26:46 -0600] [16956] [INFO] Listening at: http://192.168.1.175:9002 (16956)
[2021-06-13 10:26:46 -0600] [16956] [INFO] Using worker: sync
[2021-06-13 10:26:46 -0600] [16959] [INFO] Booting worker with pid: 16959

@sflems
Copy link
Owner

sflems commented Jun 13, 2021 via email

@pjockey
Copy link
Author

pjockey commented Jun 13, 2021

I changed the profiles back and forth between the NHL and MLB boards. It shows BoardType as being correct, but the supervisor does not start. Also, the page stays on the NHL board showing the game data. Nothing to the actual board.

@sflems
Copy link
Owner

sflems commented Jun 13, 2021

Just to confirm, is the supervisor-daemon.conf file present in the led-board-manager directory and could you post the contents?

Does a
sudo supervisorctl reread && sudo supervisorctl update all notify any changes/resync the activation? It's sounding like it hasn't been read by supervisor so that it will know where the processes are. If you retry activating a board it should have the correct locations.

If this doesn't work, could you paste the output of the supervisor log?

cat /var/log/supervisord.log

Unfortunately just the NHL games are displayed right now, showing the other leagues is a planned feature 😃

@pjockey
Copy link
Author

pjockey commented Jun 13, 2021

  GNU nano 3.2                     supervisor-daemon.conf                                

[program:led-board-manager]
command=/home/pi/led-board-manager/env/bin/gunicorn Capstone.wsgi -b 0:9002
directory=/home/pi/led-board-manager
user=pi
stopasgroup=true
stderr_logfile=/var/log/scoreboard-webgui.stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stdout_logfile=/var/log/scoreboard-webgui.stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10


[program:MLBscoreboard]
command=sudo python2 ./main.py --led-rows=32 --led-cols=64 --led-brightness=80 --led-gpi$
directory=/home/pi/mlb-led-scoreboard
autostart=false
autorestart=true
stderr_logfile=/var/log/MLBscoreboard.stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stdout_logfile=/var/log/MLBscoreboard.stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10


[program:NFLscoreboard]
command=sudo python2 ./main.py --led-rows=32 --led-cols=64 --led-brightness=80 --led-gpi$
directory=/home/pi/nfl-led-scoreboard
autostart=false
autorestart=true
stderr_logfile=/var/log/NHLscoreboard.stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stdout_logfile=/var/log/NHLscoreboard.stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10

[group:boards]
programs=MLBscoreboard,NFLscoreboard,scoreboard
pi@raspberrypi:~/led-board-manager $ sudo supervisorctl reread && sudo supervisorctl update all
No config updates to processes
pi@raspberrypi:~/led-board-manager $
pi@raspberrypi:~/led-board-manager $ cat /var/log/supervisord.log
cat: /var/log/supervisord.log: No such file or directory
pi@raspberrypi:~/led-board-manager $ 

@sflems
Copy link
Owner

sflems commented Jun 14, 2021

  GNU nano 3.2                     supervisor-daemon.conf                                

[program:led-board-manager]
command=/home/pi/led-board-manager/env/bin/gunicorn Capstone.wsgi -b 0:9002
directory=/home/pi/led-board-manager
user=pi
stopasgroup=true
stderr_logfile=/var/log/scoreboard-webgui.stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stdout_logfile=/var/log/scoreboard-webgui.stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10


[program:MLBscoreboard]
command=sudo python2 ./main.py --led-rows=32 --led-cols=64 --led-brightness=80 --led-gpi$
directory=/home/pi/mlb-led-scoreboard
autostart=false
autorestart=true
stderr_logfile=/var/log/MLBscoreboard.stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stdout_logfile=/var/log/MLBscoreboard.stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10


[program:NFLscoreboard]
command=sudo python2 ./main.py --led-rows=32 --led-cols=64 --led-brightness=80 --led-gpi$
directory=/home/pi/nfl-led-scoreboard
autostart=false
autorestart=true
stderr_logfile=/var/log/NHLscoreboard.stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stdout_logfile=/var/log/NHLscoreboard.stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10

[group:boards]
programs=MLBscoreboard,NFLscoreboard,scoreboard

It appears that the template hasn't generated correctly or is missing the scoreboard (NHL) configuration for some reason. The MLB and NFL are there, but the NFL looks mixed with the NHL section.

If you save the NHL boardType in the admin panel, or change any of the constance settings, it will regenerate the conf file again. Follow this with a reread and update all again to be sure and you should be rolling.

@pjockey
Copy link
Author

pjockey commented Jun 15, 2021

I went back into the website and poked around the Admin section, but did not change anything. I then re-did the update procedure. I run the commands you suggested in post #6. The scoreboard commands are there now.

What I have found is, everytime I run the system and go onto the website, it changes my MLB config.json to show just this "{}". The complete file has been over written.

@sflems
Copy link
Owner

sflems commented Jun 15, 2021

Sounds like we're almost there! I will look into the bug not allowing you to edit the JSON from the dash. In the meantime, I just confirmed you can edit the profile manually in the admin panel. It should save for you. This is happening because there is no schema found for the board.

There are 2 schema files included with the automatic install method. The following commands will copy them over for you and you should notice a nice form being generated.

MLB

cp ~/led-board-manager/scoreboard/static/schema/mlb.config.schema.json ~/mlb-led-scoreboard/config.schema.json

NFL

cp ~/led-board-manager/scoreboard/static/schema/nfl.config.schema.json ~/nfl-led-scoreboard/config.schema.json

@pjockey
Copy link
Author

pjockey commented Jun 15, 2021

source env/bin/activate && gunicorn Capstone.wsgi -b IP:9002
[2021-06-14 20:40:46 -0600] [1841] [INFO] Starting gunicorn 20.0.4
[2021-06-14 20:40:46 -0600] [1841] [INFO] Listening at: http://192.168.1.175:9002 (1841)
[2021-06-14 20:40:46 -0600] [1841] [INFO] Using worker: sync
[2021-06-14 20:40:46 -0600] [1844] [INFO] Booting worker with pid: 1844
boards:NHLScoreboard: ERROR (no such process)
boards:NHLScoreboard: ERROR (no such process)
Unable to start scoreboard process.
Bad Request: /command
Bad Request: /command
data must contain ['preferred', 'news_ticker', 'standings', 'rotation', 'weather', 'time_format', 'end_of_day', 'full_team_names', 'scrolling_speed', 'debug', 'demo_date'] properties
Traceback (most recent call last):
  File "/home/pi/led-board-manager/scoreboard/models.py", line 191, in pre_save
    instance.full_clean()
  File "/home/pi/led-board-manager/env/lib/python3.7/site-packages/django/db/models/base.py", line 1216, in full_clean
    self.clean()
  File "/home/pi/led-board-manager/scoreboard/models.py", line 171, in clean
    fastjsonschema.validate(self.boardType.schema(), self.config)
  File "/home/pi/led-board-manager/env/lib/python3.7/site-packages/fastjsonschema/__init__.py", line 113, in validate
    return compile(definition, handlers, formats, use_default)(data)
  File "<string>", line 10, in validate_https___github_com_sflems_led_board_manager_staticfiles_schema_mlb_config_schema_json
fastjsonschema.exceptions.JsonSchemaValueException: data must contain ['preferred', 'news_ticker', 'standings', 'rotation', 'weather', 'time_format', 'end_of_day', 'full_team_names', 'scrolling_speed', 'debug', 'demo_date'] properties
["data must contain ['preferred', 'news_ticker', 'standings', 'rotation', 'weather', 'time_format', 'end_of_day', 'full_team_names', 'scrolling_speed', 'debug', 'demo_date'] properties"]
Not Found: /profiles/4
Not Found: /profiles/4
data must contain ['preferred', 'news_ticker', 'standings', 'rotation', 'weather', 'time_format', 'end_of_day', 'full_team_names', 'scrolling_speed', 'debug', 'demo_date'] properties
Traceback (most recent call last):
  File "/home/pi/led-board-manager/scoreboard/models.py", line 191, in pre_save
    instance.full_clean()
  File "/home/pi/led-board-manager/env/lib/python3.7/site-packages/django/db/models/base.py", line 1216, in full_clean
    self.clean()
  File "/home/pi/led-board-manager/scoreboard/models.py", line 171, in clean
    fastjsonschema.validate(self.boardType.schema(), self.config)
  File "/home/pi/led-board-manager/env/lib/python3.7/site-packages/fastjsonschema/__init__.py", line 113, in validate
    return compile(definition, handlers, formats, use_default)(data)
  File "<string>", line 10, in validate_https___github_com_sflems_led_board_manager_staticfiles_schema_mlb_config_schema_json
fastjsonschema.exceptions.JsonSchemaValueException: data must contain ['preferred', 'news_ticker', 'standings', 'rotation', 'weather', 'time_format', 'end_of_day', 'full_team_names', 'scrolling_speed', 'debug', 'demo_date'] properties
["data must contain ['preferred', 'news_ticker', 'standings', 'rotation', 'weather', 'time_format', 'end_of_day', 'full_team_names', 'scrolling_speed', 'debug', 'demo_date'] properties"]
Not Found: /profiles/4
Not Found: /profiles/4

@pjockey
Copy link
Author

pjockey commented Jun 15, 2021

Screen Shot 2021-06-14 at 20 45 04

@sflems
Copy link
Owner

sflems commented Jun 15, 2021

Could you post the MLB config you are using?

Alternatively, a fillable form should now be available in the dash under New Profile > MLB.

@sflems sflems changed the title Scoreboard Status: Supervisor Process Not Running Edit JSON button does not work with empty/missing schema Jun 15, 2021
@pjockey
Copy link
Author

pjockey commented Jun 15, 2021

MLB config,json. I have tried to enter the contents of the file while creating a new board but they don't seem to stick.

{
	"preferred": {
		"teams": ["Blue Jays"],
		"divisions": ["AL East"]
	},
	"news_ticker": {
		"team_offday": true,
		"always_display": false,
		"preferred_teams": true,
		"traderumors": true,
		"mlb_news": true,
		"countdowns": true,
		"date": true,
		"date_format": "%A, %B %-d"
	},
	"standings": {
		"team_offday": true,
		"mlb_offday": true,
		"always_display": false
	},
	"rotation": {
		"enabled": true,
		"scroll_until_finished": true,
		"only_preferred": false,
		"rates": {
			"live": 15.0,
			"final": 15.0,
			"pregame": 15.0
		},
		"while_preferred_team_live": {
			"enabled": false,
			"during_inning_breaks": false
		}
	},
	"weather": {
		"apikey": "e........",
		"location": "Cranbrook, CA",
		"metric_units": true
	},
	"time_format": "24h",
	"end_of_day": "00:00",
	"full_team_names": true,
	"scrolling_speed": 2,
	"debug": false,
	"demo_date": false
}

@sflems
Copy link
Owner

sflems commented Jun 15, 2021

Looks like the schema doesnt like my demo_date definition. I'll have to make an update for it. In the mean time an empty string in demo date will work for now 👍

{
	"preferred": {
		"teams": ["Blue Jays"],
		"divisions": ["AL East"]
	},
	"news_ticker": {
		"team_offday": true,
		"always_display": false,
		"preferred_teams": true,
		"traderumors": true,
		"mlb_news": true,
		"countdowns": true,
		"date": true,
		"date_format": "%A, %B %-d"
	},
	"standings": {
		"team_offday": true,
		"mlb_offday": true,
		"always_display": false
	},
	"rotation": {
		"enabled": true,
		"scroll_until_finished": true,
		"only_preferred": false,
		"rates": {
			"live": 15.0,
			"final": 15.0,
			"pregame": 15.0
		},
		"while_preferred_team_live": {
			"enabled": false,
			"during_inning_breaks": false
		}
	},
	"weather": {
		"apikey": "e........",
		"location": "Cranbrook, CA",
		"metric_units": true
	},
	"time_format": "24h",
	"end_of_day": "00:00",
	"full_team_names": true,
	"scrolling_speed": 2,
	"debug": false,
	"demo_date": ""
}

sflems added a commit that referenced this issue Jun 19, 2021
@sflems
Copy link
Owner

sflems commented Jun 19, 2021

Just wanted to follow up to see how things were progressing.

The next update will remove the Edit JSON button from the dash, but you will still have the ability manually edit the JSON in the admin panel if needed.

@sflems sflems closed this as completed Jun 20, 2021
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

No branches or pull requests

2 participants