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

Judge0 API Dummy client #45

Closed
ghost opened this issue Apr 25, 2018 · 7 comments
Closed

Judge0 API Dummy client #45

ghost opened this issue Apr 25, 2018 · 7 comments

Comments

@ghost
Copy link

ghost commented Apr 25, 2018

Deployed production judge0 API in docker with the prescribed steps provided in the document, when testing by using dummy client we are getting this error.
URL is provided is down here.

Thank you.

Request/Response Log

[Request 25/04/2018, 16:06:32] POST http://183.82.3.219:3000/submissions?wait=true
{
"source_code": "#include <stdio.h>\n\nint main(void) {\n char name[10];\n scanf("%s", name);\n printf("hello, %s\n", name);\n return 0;\n}",
"language_id": "4",
"number_of_runs": "1",
"stdin": "Judge0",
"expected_output": "hello, Judge0",
"cpu_time_limit": "2",
"cpu_extra_time": "0.5",
"wall_time_limit": "5",
"memory_limit": "128000",
"stack_limit": "64000",
"max_processes_and_or_threads": "30",
"enable_per_process_and_thread_time_limit": false,
"enable_per_process_and_thread_memory_limit": true,
"max_file_size": "1024"
}
[Response 25/04/2018, 16:06:32] 422 Unprocessable Entity
{
"readyState": 4,
"responseText": "{"language_id":["language with id 4 doesn't exist"]}",
"responseJSON": {
"language_id": [
"language with id 4 doesn't exist"
]
},
"status": 422,
"statusText": "Unprocessable Entity"
}

[DONE 25/04/2018, 16:06:32]

@hermanzdosilovic
Copy link
Member

Hi @swamydg,

You should seed your database:

docker-compose exec api rails db:seed

After that make sure that you are getting right languages https://api.judge0.com/#statuses-and-languages-languages-get.

Let me know if I can help you more.

BR,
Herman

@ghost
Copy link
Author

ghost commented Apr 26, 2018

Hi Herman thank you for giving reply,
I executed docker-compose exec api rails db:seed command in my system,but getting same error.
Please correct me if I am wrong.

five@five:~$ docker-compose exec api rails db:seed
Running Judge0 API with configuration settings:
ENABLE_WAIT_RESULT: true
CPU_TIME_LIMIT: 2.0
MAX_CPU_TIME_LIMIT: 15.0
CPU_EXTRA_TIME: 0.5
MAX_CPU_EXTRA_TIME: 2.0
WALL_TIME_LIMIT: 5.0
MAX_WALL_TIME_LIMIT: 20.0
MEMORY_LIMIT: 128000
MAX_MEMORY_LIMIT: 256000
STACK_LIMIT: 64000
MAX_STACK_LIMIT: 128000
MAX_PROCESSES_AND_OR_THREADS: 30
MAX_MAX_PROCESSES_AND_OR_THREADS: 60
ENABLE_PER_PROCESS_AND_THREAD_TIME_LIMIT: false
ALLOW_ENABLE_PER_PROCESS_AND_THREAD_TIME_LIMIT: true
ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT: true
ALLOW_ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT: true
MAX_FILE_SIZE: 1024
MAX_MAX_FILE_SIZE: 4096
NUMBER_OF_RUNS: 1
MAX_NUMBER_OF_RUNS: 20

*** one more problem is that when I changed RAILS_ENV to production in judge0/api.conf contianer is continuously restarting... if left blank its working

RAILS_ENV= production is this the way of mentioning or any other way?

Thank you

@ghost
Copy link
Author

ghost commented Apr 27, 2018

Hi Herman
When I tried running command rails db:setup it is throwing error. Please help me fix this issue.
Thank you

PG::UndefinedColumn: ERROR: column "increment_by" does not exist
LINE 1: ...ages_id_seq"', (SELECT COALESCE(MAX("id")+(SELECT increment_...
^
/opt/.gem/gems/activerecord-5.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:598:in async_exec' /opt/.gem/gems/activerecord-5.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:598:in block in exec_no_cache'
/opt/.gem/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:589:in block in log' /opt/.gem/gems/activesupport-5.0.2/lib/active_support/notifications/instrumenter.rb:21:in instrument'
/opt/.gem/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:583:in log' /opt/.gem/gems/activerecord-5.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:598:in exec_no_cache'
/opt/.gem/gems/activerecord-5.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:585:in execute_and_clear' /opt/.gem/gems/activerecord-5.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:13:in select_value'
/opt/.gem/gems/activerecord-5.0.2/lib/active_record/connection_adapters/postgresql/schema_statements.rb:379:in reset_pk_sequence!' /usr/src/api/db/seeds.rb:287:in <top (required)>'
/opt/.gem/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in load' /opt/.gem/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in block in load'
/opt/.gem/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in load_dependency' /opt/.gem/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in load'
/opt/.gem/gems/railties-5.0.2/lib/rails/engine.rb:549:in load_seed' /opt/.gem/gems/activerecord-5.0.2/lib/active_record/tasks/database_tasks.rb:268:in load_seed'
/opt/.gem/gems/activerecord-5.0.2/lib/active_record/railties/databases.rake:196:in block (2 levels) in <top (required)>' /opt/.gem/gems/rake-11.3.0/lib/rake/task.rb:248:in block in execute'
/opt/.gem/gems/rake-11.3.0/lib/rake/task.rb:243:in each' /opt/.gem/gems/rake-11.3.0/lib/rake/task.rb:243:in execute'
/opt/.gem/gems/rake-11.3.0/lib/rake/task.rb:187:in block in invoke_with_call_chain' /usr/local/ruby-2.3.3/lib/ruby/2.3.0/monitor.rb:214:in mon_synchronize'
/opt/.gem/gems/rake-11.3.0/lib/rake/task.rb:180:in invoke_with_call_chain' /opt/.gem/gems/rake-11.3.0/lib/rake/task.rb:209:in block in invoke_prerequisites'
/opt/.gem/gems/rake-11.3.0/lib/rake/task.rb:207:in each' /opt/.gem/gems/rake-11.3.0/lib/rake/task.rb:207:in invoke_prerequisites'
/opt/.gem/gems/rake-11.3.0/lib/rake/task.rb:186:in block in invoke_with_call_chain' /usr/local/ruby-2.3.3/lib/ruby/2.3.0/monitor.rb:214:in mon_synchronize'
/opt/.gem/gems/rake-11.3.0/lib/rake/task.rb:180:in invoke_with_call_chain' /opt/.gem/gems/rake-11.3.0/lib/rake/task.rb:173:in invoke'
/opt/.gem/gems/rake-11.3.0/lib/rake/application.rb:152:in invoke_task' /opt/.gem/gems/rake-11.3.0/lib/rake/application.rb:108:in block (2 levels) in top_level'
/opt/.gem/gems/rake-11.3.0/lib/rake/application.rb:108:in each' /opt/.gem/gems/rake-11.3.0/lib/rake/application.rb:108:in block in top_level'
/opt/.gem/gems/rake-11.3.0/lib/rake/application.rb:117:in run_with_threads' /opt/.gem/gems/rake-11.3.0/lib/rake/application.rb:102:in top_level'
/opt/.gem/gems/railties-5.0.2/lib/rails/commands/rake_proxy.rb:14:in block in run_rake_task' /opt/.gem/gems/rake-11.3.0/lib/rake/application.rb:178:in standard_exception_handling'
/opt/.gem/gems/railties-5.0.2/lib/rails/commands/rake_proxy.rb:11:in run_rake_task' /opt/.gem/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:51:in run_command!'
/opt/.gem/gems/railties-5.0.2/lib/rails/commands.rb:18:in <top (required)>' bin/rails:9:in require'
bin/rails:9:in `

'
Tasks: TOP => db:setup => db:seed

@rginestou
Copy link

Same for me, after following the steps given in the README, I ended up with the same error:

ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR:  column "increment_by" does not exist
LINE 1: ...ages_id_seq"', (SELECT COALESCE(MAX("id")+(SELECT increment_...
                                                             ^
:               SELECT setval('"public"."languages_id_seq"', (SELECT COALESCE(MAX("id")+(SELECT increment_by FROM "public"."languages_id_seq"), (SELECT min_value FROM "public"."languages_id_seq")) FROM "languages"), false)

I'm also interested in knowing how to solve this issue!
Thanks

@hermanzdosilovic
Copy link
Member

Hi @swamydg and @rginestou,

sorry for the delay. I think that the problem is with postgres image version. Can you please in db service use postgres:9.6.8 image instead of latest postgres image.

Before you change that make sure you do docker-compose down and sudo rm -rf any attached folders that contain database data.

After you changed postgres image try again from the ground up with the:

$ docker-compose up -d db
$ sleep 5
$ docker-compose up -d

Please let me know if that worked out.

Can you also please send me an email with your use-case and brief explanation of why did you choose to setup your own production instance of Judge0 API? You can find my email on my GitHub page. Your email will help me understand your needs better, and allow me to improve Judge0 API. 😄

@rginestou
Copy link

Hi @hermanzdosilovic ,

Thanks, it just did the trick! 👍

@ghost
Copy link
Author

ghost commented May 1, 2018

It worked ...Thank you

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