Automate simulation process problem


(Hlias Kanatidis) #1

I need to automate a process of a simulation with only one command. I mean when i open cmd and type “gradle -runAll”, the simulation should start without import the whola path directory to run the .py file. is there any way or at least to use command line to execute a simulation using gradle command? thank you


(uklance) #2

It would take psychic ability to answer your question


(Hlias Kanatidis) #3

i am sorry mister… i am newbie here. its for my Ph. D and i would like to use gradle to make my supervisor’s life easy. But did you understand what i need to do?


(uklance) #4

I have absolutely zero idea what you’re trying to achieve, what you currently have, or what you’ve tried


(Hlias Kanatidis) #5

well my ph.d is a simulation of road network in urban environment. There are configurations files like .py. Well i need a tool that when i open cmd and type " (the tool) - runAll, without navigate to the path, the configuration file .py should start. i wish i give you a sufficient answer :smiley:


(uklance) #6

Do you realise that gradle DOES NOT have python support as part of gradle core? Python support is provided by a third party plugin(s) and the majority of users on this list have never used python with gradle

I suggest you use a concrete example. For starters tell us which gradle plugin you’re using. Explain exactly what you’re doing. Give samples of what you’ve tried so far.

Without that the chances of getting any help are slim


(Hlias Kanatidis) #7

Really? No i didnt realise that. Ithought gradle supports python. Well do you have any idea about those 3rd party plugins to use gradle so i achieve what i want? I just installed gradle i didnt use any plugin… My purpose is to automate a run process… Could you help me? Do you need any other detail?


(uklance) #8

Perhaps it’s a language barrier thing… I’m not sure how I can be any clearer

EXPLAIN EXACTLY WHAT YOU WANT, AND WHAT YOU’VE TRIED ALREADY

If you don’t get another response from me it’s because I’ve given up. I’m surprised I need to repeat this so many times to a person who will soon be referred to as “doctor”


(Hlias Kanatidis) #9

Perhaps i am writing in spanish… “explain exaclty what you want”. I want to AUTOMATE A SIMULATION PROCESS BY WRITING ON THE COMMAND LINE. when i type on the cmd “gradle run” i want the simulation start without the need of typing " cd C:/Users/…/…/…/runner.py. Got it this time or i have to explain this more times? i have already answered you the same thing about 2 times. I dont see any reason to argue with you, so mr doctor u dont have to answer to me. its ok. Thanks


(uklance) #10

Finally… a concrete requirement is beginning to emerge. Do you realise you’ve never even mentioned the word “python”?

What do you call at command line to execute the python script? What operating system are you using? I feel like I’m pulling teeth here rather than extracting a requirement


(Pepper Lebeck-Jobe) #11

I would like to interject and request that we turn up the “mutual respect” dial on this thread.

@Lance, I truly understand your frustration. It can be difficult to figure out how to help someone when they provide very little or vague details about the help they need. Also, I deeply appreciate your active participation on these forums. However, you are stepping over a line when you begin to insult the original poster. Specifically, the use of all caps in a forum like this one is equivocal to yelling in the real world. And, the bit about being surprised about having to explain things to someone who will soon be called “doctor” are really unproductive. Please refrain from indulging in this sort of response. Especially, for such obvious new-comers to the forum. On a final note, I find your claim that the original poster had never even mentioned the word “python” to be factually accurate, but purposefully obtuse given that the original post refers to “.py” files which I know you know means python is being used.

@Hlias-Kanatidis, welcome to our forum. Please accept my apology on how your initial request has been met. One of the things that makes it very difficult for members of the forum is that we are often asked to provide advice on how to do something without sufficient technical details and context. I’m sorry to say that your original post falls into this category. Many times, when we see posts with such little context, it turns out that the person requesting help hasn’t done enough research on their own, and is expecting members of the forum to just “make my problem go away.” If the problem statement is too vague or underspecified (as I am comfortable saying yours is,) whoever responds to the post is going to spend a lot of time and energy going back and forth with you trying to build up the technical details that you could have provided in the beginning. Since that scenario plays out so often on forums like this one, members of the community tend to see very short problem descriptions as disrespectful, rude or abusive. It’s like you’ve said, “I can’t be bothered to anticipate what technical details you might need to help me, but I don’t mind wasting a lot of your time trying to guess what those details are.” I am not saying that you mean to be rude or disrespectful. I’m just saying that posting a request as vague as the one you have posted can trigger someone who has a lot of experience dealing with these kinds of requests.

All that being said, let’s get back to the problem at hand:
You say you are trying to run a simulation which you would normally run using cd C:/Users/.../..../.../runner.py. I don’t believe that works. cd is a command that changes the current working directory, and you’ve supplied a python script as the argument to the command. So, that’s going to cause cd to fail. Of course, I can infer from my experience that you probably mean that your current way of running the python script is to cd to the directory where the script lives and invoke the python interpreter to run the python script. It seems like your only requirements are that you don’t want to have cd to that directory to make the script run. You’d rather run gradle run from the command line. But, what we are missing is a lot of details.

  • Why is it not acceptable to cd to the directory?
  • Why can’t you just run python.exe C:/Users/<path>/runner.py?
  • What problem are you trying to solve by adding Gradle into the mix?
    • Is it reproducibility?
    • Is there other custom logic you want to add to the automated process?
  • What have you already tried?
  • What version of Gradle are you using?
  • What version of Python are you using?
  • Is it possible to share the exact source code of your simulation with us?
    • Then you could provide exact instructions on how to run the simulation currently, and explain how you want it to run in the future?
  • If not, can you provide an example source code repository on GitHub that is similar to what you are trying to do so we can work with a real example?

Please provide answers to these questions, or it will be difficult for us to help you.


(Hlias Kanatidis) #12

Hello sir,

Well i can understand your point. I dont know what exactly is happening
over here. I just ask a question. If someone answers “yes i know what are
you talking about” i would ask him “tell me what detailts do you need to
provide you”.
When u are going i an shop to buy a bed the converation is going like that
-Hello how can i help you?
-Well i want this and this and that, can you help me?
-No i cant sorry

  • its ok thank you…

OR

-Great, i can do it. Give me some details about dimensions, about the
material, about the length about about about…
-Dimensions are there:, Material is this.

Should i imagine or guess oor something what does he need? i.e. my
graphiics card is nvidia geforce, does it help you? How could i know what
details you, and every you, need? I understand what are you saying and what
the doctor is saying and of course i can provide more but if u check the
conversation i have answered to his question more than 2 time at the same
question. Anyway Thank you for the cooperation, have a nice day.


#13

From what I understand, you want Gradle to start your Python script in a specific directory, right? It seems like you need to add an Exec task and set the workingDir, as documented here.


(Hlias Kanatidis) #14

Exactly… Thank you very much. But tell me, if u read the chat, was it so hard to understand what i needed or did you need more details like operating system or python version or…? Thank you very much…


(uklance) #15

If you just want to execute a single python script then sure, an exec task will do the job. I’d argue that in that simple instance gradle is a bit heavy weight for your needs and a shell script would probably be a better choice rather than involving gradle.

Gradle is much more than this, which is why if you give more information we can help you better. If your scripts have dependencies on other libraries gradle can help there. If you want to create a gradle task for every file in a directory it can. If you want to package your application or need one task to depends on another etc etc.

Put simply, if you ask a better question, you’ll get a better answer


(Hlias Kanatidis) #16

My friend how many times i told you that i just want to execute a simple
python script? 2 times? 3 times? and whats your answer? " i am surprised
that you will be referred as doctor in the future". I saw no reason for
that answer but anyway it was more simple as u can see. i agree with you
that gradle is more than this but i dont need more than this. My work is
done and i just need a tool to automate a process so as to be more easier
to my supervisor and any user to execute. That’s all. I agree with anything
you said about details but you could tell me exactly what you needed and i
would provide anything.


(uklance) #17

My comments earlier started cheeky and possibly crossed the line into rude and for that I apologise.

As a newbie to gradle I was hoping that if you gave a better description of your system we could help you in ways you hadn’t thought of.


(Hlias Kanatidis) #18

I know you tried to help me and without more specific information it would
be hard for you to guess…I am sorry too if i wasnt so specific as it needs
to. Everything is ok.