GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Cloud Sync by previ · Pull Request #199 · CoderBotOrg/backend

Cloud Sync #199

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.

Sign up for GitHub

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

Draft
previ wants to merge 60 commits into develop
base: develop
Loading
Loading
from feat/cloud_sync

Uh oh!

There was an error while loading. Please reload this page.

Draft

Cloud Sync #199

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
51f0346
sync setting, activities
previ Apr 10, 2023
c857b1a
wip
previ Apr 18, 2023
a2e6f39
wip
previ Apr 25, 2023
e17230d
wip
previ May 7, 2023
29b0dc4
wip
previ May 21, 2023
15d215d
wip
previ May 28, 2023
f5a4395
wip
previ May 29, 2023
57b2f03
wip
previ Jun 1, 2023
19a4398
wip
previ Jun 2, 2023
9377a57
wip
previ Jun 4, 2023
1cf11aa
wip
previ Jun 4, 2023
8f0e377
wip
previ Jun 4, 2023
0607076
wip
previ Jun 5, 2023
fba1635
wip
previ Jun 5, 2023
e5a2592
wip
previ Jun 5, 2023
870ea4b
wip
previ Jun 5, 2023
ab77159
wip
previ Jun 5, 2023
0b84abb
wip
previ Jun 5, 2023
cb8f7f9
wip
previ Jun 5, 2023
0645172
wip
previ Jun 5, 2023
304f221
wip
previ Jun 5, 2023
affa726
wip
previ Jun 5, 2023
b2999aa
wip
previ Jun 6, 2023
a430f2a
wip
previ Jun 11, 2023
639d4b9
wip
previ Aug 16, 2023
f23d78f
wip
previ Aug 16, 2023
1ba0456
update default config.json
previ Aug 19, 2023
bd2ee94
increase initial delay for testing
previ Aug 19, 2023
f1817f8
debug test api
previ Aug 19, 2023
16ffbad
debug tests
previ Aug 19, 2023
b49c58d
debug tests
previ Aug 19, 2023
24ef531
Update camera_test.py - fix tests
previ Aug 19, 2023
52f5dd1
Update coderbot_test.py - fix
previ Aug 19, 2023
f65bc87
Update camera_test.py fix
previ Aug 19, 2023
7c13bb3
Update coderbot_test.py fix
previ Aug 19, 2023
7070b18
Update coderbot_test.py -fix
previ Aug 19, 2023
14f6478
Update coderbot_test.py fix servo test
previ Aug 19, 2023
164da91
Update Dockerfile stub add CODERBOT_CLOUD_API_ENDPOINT
previ Aug 19, 2023
45e0bce
fixes
previ Aug 26, 2023
8198e09
fix
previ Aug 27, 2023
bfaa258
fix
previ Aug 27, 2023
6969fea
fix
previ Aug 27, 2023
f639184
fix
previ Aug 27, 2023
24dde58
fix
previ Aug 27, 2023
f50165b
wip
previ Dec 23, 2023
4967d4d
bumo deps
previ Dec 24, 2023
ffcb801
bump deps
previ Dec 24, 2023
b6a4401
bump deps
previ Dec 24, 2023
d8ef622
fix audio_devide
previ Dec 24, 2023
e929c0e
fix bot, cam
previ Dec 24, 2023
c89f25c
fix video stream
previ Dec 24, 2023
9ad1051
add uuid
previ Dec 28, 2023
f561d46
add uuid
previ Dec 28, 2023
5880e87
add uuid
previ Dec 28, 2023
2b1be19
add uuid
previ Dec 28, 2023
ca68f8f
fix sync activity, program
previ Dec 30, 2023
e0582ac
fix daveProgram case of null body
previ Dec 31, 2023
e214e59
sync settings
previ Dec 31, 2023
93735f7
fix detectMultiScale
previ Feb 28, 2024
13e081a
schemathesis==3.24.3
previ Mar 28, 2024
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
wip
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@previ
previ committed Jun 11, 2023
commit a430f2ad334e1dcafe7c18bcb1aad30afc71c7fa

There are no files selected for viewing

20 changes: 19 additions & 1 deletion 20 coderbot/api.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -412,4 +412,22 @@ def cloudSyncRequest():
return 200

def cloudSyncStatus():
return CloudManager.get_instance().sync_status()
return CloudManager.get_instance().sync_status()

def cloudRegistrationRequest():
CloudManager.get_instance().register()
return 200

def cloudRegistrationDelete():
CloudManager.get_instance().unregister()
return 200

def cloudRegistrationStatus():
return {
"registered": CloudManager.get_instance().registration_status(),
"name": config.get('coderbot_name', ""),
"description": config.get('coderbot_description', ""),
"org_id": config.get('org_id', ""),
"org_name": config.get('org_name', ""),
"org_description": config.get('org_description', "")
}
60 changes: 47 additions & 13 deletions 60 coderbot/cloud/__init__.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,36 @@ def __init__(self):
self.write_auth({})
self.start()

def register(self, registration_request):
logging.info("register.check.token")
token = self.get_auth().get("token")
if token:
logging.warn("register.check.token_already_there")
return
reg_otp = registration_request.get("otp")
try:
self._sync_status["registration"] = "registering"
logging.info("register.get_token")
with cloud_api_robot_client.ApiClient(self.configuration) as api_client:
api_instance = robot_sync_api.RobotSyncApi(api_client)
body = RobotRegisterData(
otp=reg_otp,
)
api_response = api_instance.register_robot(body=body)
logging.info(api_response.body)
token = api_response.body.get("token")
self.write_auth({"token":token})
self._sync_status["registration"] = "registered"
except cloud_api_robot_client.ApiException as e:
logging.warn("Exception when calling register_robot RobotSyncApi: %s\n" % e)
raise

def unregister(self):
self.write_auth({ "token": None })

def registration_status(self):
return self._auth.get("token") is not None

def run(self):
while(True):
sync_period = int(Config.read().get("sync_period", "60"))
Expand All @@ -109,20 +139,21 @@ def sync(self):
logging.info("run.sync.begin")
sync_modes = settings.get("sync_modes", {"settings": "n", "activities": "n", "programs": "n"})

try:
token = self.get_token_or_register(settings)
self.configuration.access_token = token
token = self.get_auth().get("token")
if token is not None:
try:
self.configuration.access_token = token

# Enter a context with an instance of the API client
with cloud_api_robot_client.ApiClient(self.configuration) as api_client:
# Create an instance of the API class
api_instance = robot_sync_api.RobotSyncApi(api_client)

self.sync_settings(api_instance, sync_modes["settings"])
self.sync_activities(api_instance, sync_modes["activities"])
self.sync_programs(api_instance, sync_modes["programs"])
except Exception as e:
logging.warn("run.sync.api_not_available: " + str(e))
# Enter a context with an instance of the API client
with cloud_api_robot_client.ApiClient(self.configuration) as api_client:
# Create an instance of the API class
api_instance = robot_sync_api.RobotSyncApi(api_client)
self.sync_settings(api_instance, sync_modes["settings"])
self.sync_activities(api_instance, sync_modes["activities"])
self.sync_programs(api_instance, sync_modes["programs"])
except Exception as e:
logging.warn("run.sync.api_not_available: " + str(e))

logging.info("run.sync.end")
self._syncing = False
Expand All @@ -133,6 +164,7 @@ def get_token_or_register(self, settings):
reg_otp = settings.get("reg_otp")
try:
if token is None and reg_otp is not None:
self._sync_status["registration"] = "registering"
logging.info("run.get_token_or_register.get_token")
with cloud_api_robot_client.ApiClient(self.configuration) as api_client:
api_instance = robot_sync_api.RobotSyncApi(api_client)
Expand All @@ -143,6 +175,7 @@ def get_token_or_register(self, settings):
logging.info(api_response.body)
token = api_response.body.get("token")
self.write_auth({"token":token})
self._sync_status["registration"] = "registered"
return token
except cloud_api_robot_client.ApiException as e:
logging.warn("Exception when calling register_robot RobotSyncApi: %s\n" % e)
Expand Down Expand Up @@ -181,6 +214,7 @@ def sync_settings(self, api_instance, sync_mode):
self._sync_status["settings"] = "synced"
except cloud_api_robot_client.ApiException as e:
logging.warn("Exception when calling settings RobotSyncApi: %s\n" % e)
self._sync_status["registration"] = "failed"

def sync_activities(self, api_instance, sync_mode):
try:
Expand Down
79 changes: 78 additions & 1 deletion 79 coderbot/v1.yml
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,49 @@ paths:
responses:
200:
description: "CNN Model deleted"

/cloud/registration:
post:
operationId: "api.cloudRegistrationRequest"
summary: "request a Registration activity"
tags:
- Cloud Sync
requestBody:
description: Registration Request parameters
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CloudRegistrationRequest'
responses:
200:
description: "Cloud Sync request"
get:
operationId: "api.cloudRegistrationStatus"
summary: "get status of a Registration activity"
tags:
- Cloud Sync
responses:
200:
description: "Cloud Sync request"
content:
application/json:
schema:
$ref: '#/components/schemas/CloudRegistrationStatus'

delete:
operationId: "api.cloudRegistrationDelete"
summary: "get status of a Registration activity"
tags:
- Cloud Sync
responses:
200:
description: "Cloud Sync request"
content:
application/json:
schema:
$ref: '#/components/schemas/CloudRegistrationStatus'

/cloud/sync:
post:
operationId: "api.cloudSyncRequest"
Expand Down Expand Up @@ -743,7 +786,41 @@ components:
- description
- default
- kind


CloudRegistrationRequest:
type: object
properties:
name:
type: string
minLength: 4
maxLength: 64
description:
type: string
minLength: 4
maxLength: 256
otp:
type: string
minLength: 8
maxLength: 8

CloudRegistrationStatus:
type: object
properties:
name:
type: string
minLength: 1
maxLength: 64
description:
type: string
minLength: 0
maxLength: 256
org_id:
type: string
org_name:
type: string
org_description:
type: string

CloudSyncStatus:
type: object
properties:
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.