shaipeerms commited on
Commit
e422f61
1 Parent(s): fbb1d85

Added validate_zip tests

Browse files
Files changed (1) hide show
  1. server.py +7 -16
server.py CHANGED
@@ -34,7 +34,7 @@ class LeaderboardServer:
34
  Args:
35
  hf_token: the hf token to get the submissions of
36
  """
37
- self._LOG.info(f'Getting submissions for hf token: {hf_token}')
38
  endpoint = f'{self._server_address}/submissions'
39
  response = requests.get(endpoint, params={'token': hf_token})
40
  if response.status_code != 200:
@@ -49,7 +49,7 @@ class LeaderboardServer:
49
  Args:
50
  hf_token: the hf token to validate
51
  """
52
- self._LOG.info(f'Validating hf token: {hf_token}')
53
  endpoint = f'{self._server_address}/validate_hf_token'
54
  response = requests.get(endpoint, params={'token': hf_token})
55
  if response.status_code != 200:
@@ -64,7 +64,7 @@ class LeaderboardServer:
64
  Args:
65
  hf_token: the hf token to get the submissions count of
66
  """
67
- self._LOG.info(f'Getting submissions count for hf token: {hf_token} in the last 24 hours')
68
  endpoint = f'{self._server_address}/submission_count_last_24_hours'
69
  response = requests.get(endpoint, params={'token': hf_token})
70
  if response.status_code != 200:
@@ -79,16 +79,7 @@ class LeaderboardServer:
79
  Args:
80
  token: the token of the team
81
  file_path: the path of the file to submit
82
- metadata: the metadata of the submission, structure:
83
- {
84
- 'challenge_name': 'NOTSOFAR1',
85
- 'team_name': (str),
86
- 'submission_type': (str),
87
- 'token': (str),
88
- 'file_name': (str),
89
- 'file_size_mb': (int),
90
- 'ip': (str) xxx.xxx.xxx.xxx
91
- }
92
  """
93
  self._LOG.info(f'Adding submission for team: {metadata["team_name"]}, '
94
  f'submission type: {metadata["submission_type"]}')
@@ -105,9 +96,9 @@ class LeaderboardServer:
105
  return response.json()
106
 
107
 
108
- def test_server():
109
  """
110
- Basic server tests for the leaderboard server
111
  """
112
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
113
 
@@ -146,4 +137,4 @@ def test_server():
146
 
147
 
148
  if __name__ == '__main__':
149
- test_server()
 
34
  Args:
35
  hf_token: the hf token to get the submissions of
36
  """
37
+ self._LOG.info(f'Fetching submissions')
38
  endpoint = f'{self._server_address}/submissions'
39
  response = requests.get(endpoint, params={'token': hf_token})
40
  if response.status_code != 200:
 
49
  Args:
50
  hf_token: the hf token to validate
51
  """
52
+ self._LOG.info(f'Validating hf token')
53
  endpoint = f'{self._server_address}/validate_hf_token'
54
  response = requests.get(endpoint, params={'token': hf_token})
55
  if response.status_code != 200:
 
64
  Args:
65
  hf_token: the hf token to get the submissions count of
66
  """
67
+ self._LOG.info(f'fetching submissions count for the last 24 hours')
68
  endpoint = f'{self._server_address}/submission_count_last_24_hours'
69
  response = requests.get(endpoint, params={'token': hf_token})
70
  if response.status_code != 200:
 
79
  Args:
80
  token: the token of the team
81
  file_path: the path of the file to submit
82
+ metadata: the metadata of the submission
 
 
 
 
 
 
 
 
 
83
  """
84
  self._LOG.info(f'Adding submission for team: {metadata["team_name"]}, '
85
  f'submission type: {metadata["submission_type"]}')
 
96
  return response.json()
97
 
98
 
99
+ def main():
100
  """
101
+ Usage of the LeaderboardServer class
102
  """
103
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
104
 
 
137
 
138
 
139
  if __name__ == '__main__':
140
+ main()