aimclub / aimclub/OSA

bug: Incorrect Exit Code Status during Docstring Generation

Aperta
#287 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Python
Stelle
143
Fork
23
Merge medio
5g 9h
PR unite (30g)
2

Descrizione

## Description

During the execution of OSA with the docstring generation task, an incorrect exit code status was observed. This issue needs to be addressed to ensure correct programmatic handling of exit statuses during task execution.

## Expected Behavior
The exit code status should accurately reflect the success or failure state of the docstring generation task.

## Current Behavior
The exit code status is incorrect, leading to potential issues in downstream processes or scripts that rely on accurate exit codes.

## Log Example

``` txt
[02:31:51] INFO [02:31:51] - Output path changed to /home/ilya/OSA/popular_3__OSA_gpt4_1 run.py:66
INFO [02:31:51] - Config successfully updated and loaded run.py:335
INFO [02:31:51] - Successfully fetched GitHub metadata for repository: 'pvlib/pvlib-python' metadata.py:255
INFO [02:31:51] - Cloning the 'main' branch from https://github.com/pvlib/pvlib-python into directory git_agent.py:344
/home/ilya/OSA/popular_3__OSA_gpt4_1/pvlib-python...
[02:32:04] INFO [02:32:04] - Cloning completed git_agent.py:353
INFO [02:32:04] - Basic mode selected for task scheduler. scheduler.py:56
INFO [02:32:04] - Web mode enabled, returning plan for web interface. scheduler.py:88

────────────────────────────────────────────────────────────────────────── Docstrings generation ───────────────────────────────────────────────────────────────────────────
INFO [02:32:04] - Docstrings generation for the project has started! docgen.py:692
INFO [02:32:04] - File pvlib-python/setup.py does not contain any functions, methods or class constructions. docgen.py:689
INFO [02:32:04] - Requesting for docstrings generation for the function: set_solar_position at pvlib-python/benchmarks/benchmarks/location.py docgen.py:842
INFO [02:32:04] - Requesting for docstrings generation for the method: setup of class Location at docgen.py:820
pvlib-python/benchmarks/benchmarks/location.py
INFO [02:32:04] - Requesting for docstrings generation for the method: time_location_get_airmass of class Location at docgen.py:820
pvlib-python/benchmarks/benchmarks/location.py
INFO [02:32:04] - Requesting for docstrings generation for the method: time_location_get_solarposition of class Location at docgen.py:820
pvlib-python/benchmarks/benchmarks/location.py
INFO [02:32:04] - Requesting for docstrings generation for the method: time_location_get_clearsky of class Location at docgen.py:820
pvlib-python/benchmarks/benchmarks/location.py
INFO [02:32:04] - Requesting for docstrings generation for the method: setup of class Location_0_6_1 at docgen.py:820
pvlib-python/benchmarks/benchmarks/location.py
INFO [02:32:04] - Requesting for docstrings generation for the method: time_location_get_sun_rise_set_transit_pyephem of class Location_0_6_1 docgen.py:820
at pvlib-python/benchmarks/benchmarks/location.py
INFO [02:32:04] - Requesting for docstrings generation for the method: time_location_get_sun_rise_set_transit_spa of class Location_0_6_1 at docgen.py:820
pvlib-python/benchmarks/benchmarks/location.py
[02:32:05] INFO [02:32:05] - HTTP Request: POST https://openrouter.ai/api/v1/chat/completions "HTTP/1.1 403 Forbidden" _client.py:1786
INFO [02:32:05] - HTTP Request: POST https://openrouter.ai/api/v1/chat/completions "HTTP/1.1 403 Forbidden" _client.py:1786
ERROR [02:32:05] - Error while generating codebase documentation: PermissionDeniedError("Error code: 403 - {'error': {'message': 'Key limit run.py:291
exceeded. Manage it using https://openrouter.ai/settings/keys', 'code': 403}}")
Traceback (most recent call last):
File "/home/ilya/OSA/osa_tool/run.py", line 246, in generate_docstrings
fn_generated_docstrings = loop.run_until_complete(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/ilya/OSA/osa_tool/osatreesitter/docgen.py", line 699, in _generate_docstrings_for_items
generating_results = await _iterate_and_collect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ilya/OSA/osa_tool/osatreesitter/docgen.py", line 687, in _iterate_and_collect
results[filename] = await collect_fn(filename, structure, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ilya/OSA/osa_tool/osatreesitter/docgen.py", line 858, in _fetch_docstrings
fetched_docstrings = await asyncio.gather(*[task[1] for task in _coroutines[key]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ilya/OSA/osa_tool/osatreesitter/docgen.py", line 289, in generate_method_documentation
return await self.model_handler.async_request(prompt)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ilya/OSA/osa_tool/models/models.py", line 180, in async_request
response = await self.client.ainvoke(self.payload["messages"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/ilya/.cache/pypoetry/virtualenvs/osa-tool-hFIV0qD6-py3.12/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py",
line 415, in ainvoke
llm_result = await self.agenerate_prompt(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/ilya/.cache/pypoetry/virtualenvs/osa-tool-hFIV0qD6-py3.12/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py",
line 1030, in agenerate_prompt
return await self.agenerate(
^^^^^^^^^^^^^^^^^^^^^
File
"/home/ilya/.cache/pypoetry/virtualenvs/osa-tool-hFIV0qD6-py3.12/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py",
line 988, in agenerate
raise exceptions[0]
File
"/home/ilya/.cache/pypoetry/virtualenvs/osa-tool-hFIV0qD6-py3.12/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py",
line 1158, in _agenerate_with_cache
result = await self._agenerate(
^^^^^^^^^^^^^^^^^^^^^^
File "/home/ilya/.cache/pypoetry/virtualenvs/osa-tool-hFIV0qD6-py3.12/lib/python3.12/site-packages/langchain_openai/chat_models/base.py",
line 960, in _agenerate
response = await self.async_client.create(**payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ilya/.cache/pypoetry/virtualenvs/osa-tool-hFIV0qD6-py3.12/lib/python3.12/site-packages/openai/resources/chat/completions.py",
line 1720, in create
return await self._post(
^^^^^^^^^^^^^^^^^
File "/home/ilya/.cache/pypoetry/virtualenvs/osa-tool-hFIV0qD6-py3.12/lib/python3.12/site-packages/openai/_base_client.py", line 1843, in
post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ilya/.cache/pypoetry/virtualenvs/osa-tool-hFIV0qD6-py3.12/lib/python3.12/site-packages/openai/_base_client.py", line 1537, in
request
return await self._request(
^^^^^^^^^^^^^^^^^^^^
File "/home/ilya/.cache/pypoetry/virtualenvs/osa-tool-hFIV0qD6-py3.12/lib/python3.12/site-packages/openai/_base_client.py", line 1638, in
_request
raise self._make_status_error_from_response(err.response) from None
openai.PermissionDeniedError: Error code: 403 - {'error': {'message': 'Key limit exceeded. Manage it using
https://openrouter.ai/settings/keys', 'code': 403}}

────────────────────────────────────────────────────────────────── All operations completed successfully ───────────────────────────────────────────────────────────────────
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.