Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
Hi There, I'M Integrating Trains - Looks Great So Far! We Wanted To Be Able To Monitor Which User Created An Experiment. I'Ve Noticed I Can Create A User Using The

Hi there, I'm integrating trains - looks great so far! We wanted to be able to monitor which user created an experiment. I've noticed I can create a user using the /opt/trains/config/apiserver.conf , and then creating credentials for each one will show them as the user. It's a bit cumbersome... I was wondering if there is any other way to define the user without creating special credentials.
Thanks!!

  
  
Posted 3 years ago
Votes Newest

Answers 19


Hi CleanPigeon16 ,
I'm not sure I follow what you mean.

and then creating credentials for each one will show them as the user

How exactly?
Depending on how you set up Trains Server, you can create user identities either by:
Using a "flexible" user mode in which your user identity is determined by the name you provide when logging into the UI (i.e. when you do not configure apiserver.conf ) Using a "fixed" users list you define in the apiserver.conf file (in which you provide a display name, a user name and a password for each user identity)Regardless of how you created your user identity, you will need to go to your profile page in the UI, and obtain a set of credentials with which you can configure your Trains Python package (using trains init or by editing trains.conf ) - unless you do that, when Trains runs it can't know which user you're supposed to be...

What exactly were you thinking of?

  
  
Posted 3 years ago

I was thinking about sending the parameters programatically. We have different pipelines that can generate tasks, I would like to be able to tell trains the user who started the pipeline.

  
  
Posted 3 years ago

cool! just to verify - I'll still need to have the credentials created in the server, right?

  
  
Posted 3 years ago

Well, that's possible - take a look at Task.set_credentials() 🙂

  
  
Posted 3 years ago

Sending programmatically how? You mean inside your pipeline script?

  
  
Posted 3 years ago

yeah, maybe as an option in the Task.init

  
  
Posted 3 years ago

Well... assuming you could have used the username and password - that would mean you have those hard coded in scripts or files somewhere, and unlike the credentials you generate - they can't be revoked and re-generated in case something is wrong...

  
  
Posted 3 years ago

legit, I was thinking only about task tracking, less about user based credentials. good point

  
  
Posted 3 years ago

so no magic "username" key? 😛

  
  
Posted 3 years ago

Yup

  
  
Posted 3 years ago

what about using ENV variables? is it possible to override the config file's credentials?

  
  
Posted 3 years ago

Yes, use TRAINS_API_ACCESS_KEY and TRAINS_API_SECRET_KEY

  
  
Posted 3 years ago

Well, if you must know, you can 😄

  
  
Posted 3 years ago

But I would not recommend it 🙂

  
  
Posted 3 years ago

Thanks!

  
  
Posted 3 years ago

ok, hopefully last question on this subject 🙂
I want to use Jenkins for some pipelines. What I would like to do is have one set of credentials saved on Jenkins. Then whenever a user triggers a pipeline - this is the user that will be marked as the task's user.
If I understand the options you suggested, I'll currently need either to (1) have some mapping between users and their credentials and have all the credentials saved on Jenkins; or, (2) have each user manually add 2 environment variables for as parameters to the pipeline.
Am I missing something? Are those the possible solutions?

  
  
Posted 3 years ago

Sounds reasonable...

  
  
Posted 3 years ago

You can call it before calling Task.init as it's a class method and configures the local session

  
  
Posted 3 years ago

That's not really recommended, security-wise

  
  
Posted 3 years ago
588 Views
19 Answers
3 years ago
one year ago
Tags